aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvmc2
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvmc2')
-rw-r--r--tools/llvmc2/Action.cpp8
-rw-r--r--tools/llvmc2/llvmc.cpp2
2 files changed, 8 insertions, 2 deletions
diff --git a/tools/llvmc2/Action.cpp b/tools/llvmc2/Action.cpp
index 183dd81..0841626 100644
--- a/tools/llvmc2/Action.cpp
+++ b/tools/llvmc2/Action.cpp
@@ -22,6 +22,7 @@
using namespace llvm;
using namespace llvmc;
+extern cl::opt<bool> DryRun;
extern cl::opt<bool> VerboseMode;
namespace {
@@ -65,10 +66,13 @@ namespace {
}
int llvmc::Action::Execute() const {
- if (VerboseMode) {
+ if (DryRun || VerboseMode) {
std::cerr << Command_ << " ";
std::for_each(Args_.begin(), Args_.end(), print_string);
std::cerr << '\n';
}
- return ExecuteProgram(Command_, Args_);
+ if (DryRun)
+ return 0;
+ else
+ return ExecuteProgram(Command_, Args_);
}
diff --git a/tools/llvmc2/llvmc.cpp b/tools/llvmc2/llvmc.cpp
index e093439..9a2b27f 100644
--- a/tools/llvmc2/llvmc.cpp
+++ b/tools/llvmc2/llvmc.cpp
@@ -41,6 +41,8 @@ cl::opt<std::string> OutputFilename("o", cl::desc("Output file name"),
cl::list<std::string> Languages("x",
cl::desc("Specify the language of the following input files"),
cl::ZeroOrMore);
+cl::opt<bool> DryRun("dry-run",
+ cl::desc("only pretend to run commands"));
cl::opt<bool> VerboseMode("v",
cl::desc("Enable verbose mode"));
cl::opt<bool> WriteGraph("write-graph",