projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix warning when assertions disabled.
[oota-llvm.git]
/
tools
/
llvmc2
/
Action.cpp
diff --git
a/tools/llvmc2/Action.cpp
b/tools/llvmc2/Action.cpp
index 3d61d37368ff7436af18011a464695b51bed5136..08416263a1bdc97c1cfd9dfcea67277aaa161cbf 100644
(file)
--- a/
tools/llvmc2/Action.cpp
+++ b/
tools/llvmc2/Action.cpp
@@
-1,4
+1,4
@@
-//===---
Tools.h - The LLVM Compiler Driver ---
------------------*- C++ -*-===//
+//===---
Action.cpp - The LLVM Compiler Driver
------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
//
// The LLVM Compiler Infrastructure
//
@@
-22,11
+22,12
@@
using namespace llvm;
using namespace llvmc;
using namespace llvm;
using namespace llvmc;
+extern cl::opt<bool> DryRun;
extern cl::opt<bool> VerboseMode;
namespace {
int ExecuteProgram(const std::string& name,
extern cl::opt<bool> VerboseMode;
namespace {
int ExecuteProgram(const std::string& name,
- const Str
ing
Vector& args) {
+ const StrVector& args) {
sys::Path prog = sys::Program::FindProgramByName(name);
if (prog.isEmpty())
sys::Path prog = sys::Program::FindProgramByName(name);
if (prog.isEmpty())
@@
-34,7
+35,7
@@
namespace {
if (!prog.canExecute())
throw std::runtime_error("Program '" + name + "' is not executable.");
if (!prog.canExecute())
throw std::runtime_error("Program '" + name + "' is not executable.");
- // Build the command line vector and
redirects
.
+ // Build the command line vector and
the redirects array
.
const sys::Path* redirects[3] = {0,0,0};
sys::Path stdout_redirect;
const sys::Path* redirects[3] = {0,0,0};
sys::Path stdout_redirect;
@@
-42,7
+43,7
@@
namespace {
argv.reserve((args.size()+2));
argv.push_back(name.c_str());
argv.reserve((args.size()+2));
argv.push_back(name.c_str());
- for (Str
ing
Vector::const_iterator B = args.begin(), E = args.end();
+ for (StrVector::const_iterator B = args.begin(), E = args.end();
B!=E; ++B) {
if (*B == ">") {
++B;
B!=E; ++B) {
if (*B == ">") {
++B;
@@
-65,10
+66,13
@@
namespace {
}
int llvmc::Action::Execute() const {
}
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';
}
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_);
}
}