diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2008-05-30 18:48:52 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2008-05-30 18:48:52 +0000 |
commit | 0bd4dbad3d4c369394fac428d0eecd04cbc4444f (patch) | |
tree | a20354b1f4f69ae7b119f6863ee24265bc3c36a4 /tools/llvmc2 | |
parent | 7fb9cde7e293ad6b1cf6881fba135886da79aa2c (diff) | |
download | external_llvm-0bd4dbad3d4c369394fac428d0eecd04cbc4444f.zip external_llvm-0bd4dbad3d4c369394fac428d0eecd04cbc4444f.tar.gz external_llvm-0bd4dbad3d4c369394fac428d0eecd04cbc4444f.tar.bz2 |
Add a --dry-run option to llvmc2. Patch by Holger Schurig.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51781 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc2')
-rw-r--r-- | tools/llvmc2/Action.cpp | 8 | ||||
-rw-r--r-- | tools/llvmc2/llvmc.cpp | 2 |
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", |