diff options
Diffstat (limited to 'lib/Driver/Compilation.cpp')
-rw-r--r-- | lib/Driver/Compilation.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp index 7e29b67769..ad3cb8dbe1 100644 --- a/lib/Driver/Compilation.cpp +++ b/lib/Driver/Compilation.cpp @@ -23,20 +23,20 @@ using namespace clang::driver; Compilation::Compilation(const Driver &D, const ToolChain &_DefaultToolChain, - InputArgList *_Args) + InputArgList *_Args) : TheDriver(D), DefaultToolChain(_DefaultToolChain), Args(_Args) { } -Compilation::~Compilation() { +Compilation::~Compilation() { delete Args; - + // Free any derived arg lists. - for (llvm::DenseMap<const ToolChain*, DerivedArgList*>::iterator + for (llvm::DenseMap<const ToolChain*, DerivedArgList*>::iterator it = TCArgs.begin(), ie = TCArgs.end(); it != ie; ++it) delete it->second; // Free the actions, if built. - for (ActionList::iterator it = Actions.begin(), ie = Actions.end(); + for (ActionList::iterator it = Actions.begin(), ie = Actions.end(); it != ie; ++it) delete *it; } @@ -52,7 +52,7 @@ const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC) { return *Entry; } -void Compilation::PrintJob(llvm::raw_ostream &OS, const Job &J, +void Compilation::PrintJob(llvm::raw_ostream &OS, const Job &J, const char *Terminator, bool Quote) const { if (const Command *C = dyn_cast<Command>(&J)) { OS << " \"" << C->getExecutable() << '"'; @@ -65,22 +65,22 @@ void Compilation::PrintJob(llvm::raw_ostream &OS, const Job &J, } OS << Terminator; } else if (const PipedJob *PJ = dyn_cast<PipedJob>(&J)) { - for (PipedJob::const_iterator + for (PipedJob::const_iterator it = PJ->begin(), ie = PJ->end(); it != ie; ++it) PrintJob(OS, **it, (it + 1 != PJ->end()) ? " |\n" : "\n", Quote); } else { const JobList *Jobs = cast<JobList>(&J); - for (JobList::const_iterator + for (JobList::const_iterator it = Jobs->begin(), ie = Jobs->end(); it != ie; ++it) PrintJob(OS, **it, Terminator, Quote); } } -bool Compilation::CleanupFileList(const ArgStringList &Files, +bool Compilation::CleanupFileList(const ArgStringList &Files, bool IssueErrors) const { bool Success = true; - for (ArgStringList::const_iterator + for (ArgStringList::const_iterator it = Files.begin(), ie = Files.end(); it != ie; ++it) { llvm::sys::Path P(*it); std::string Error; @@ -92,7 +92,7 @@ bool Compilation::CleanupFileList(const ArgStringList &Files, // FIXME: Grumble, P.exists() is broken. PR3837. struct stat buf; - if (::stat(P.c_str(), &buf) == 0 + if (::stat(P.c_str(), &buf) == 0 || errno != ENOENT) { if (IssueErrors) getDriver().Diag(clang::diag::err_drv_unable_to_remove_file) @@ -112,12 +112,12 @@ int Compilation::ExecuteCommand(const Command &C, Argv[0] = C.getExecutable(); std::copy(C.getArguments().begin(), C.getArguments().end(), Argv+1); Argv[C.getArguments().size() + 1] = 0; - + if (getDriver().CCCEcho || getArgs().hasArg(options::OPT_v)) PrintJob(llvm::errs(), C, "\n", false); - + std::string Error; - int Res = + int Res = llvm::sys::Program::ExecuteAndWait(Prog, Argv, /*env*/0, /*redirects*/0, /*secondsToWait*/0, /*memoryLimit*/0, @@ -126,7 +126,7 @@ int Compilation::ExecuteCommand(const Command &C, assert(Res && "Error string set with 0 result code!"); getDriver().Diag(clang::diag::err_drv_command_failure) << Error; } - + if (Res) FailingCommand = &C; @@ -134,7 +134,7 @@ int Compilation::ExecuteCommand(const Command &C, return Res; } -int Compilation::ExecuteJob(const Job &J, +int Compilation::ExecuteJob(const Job &J, const Command *&FailingCommand) const { if (const Command *C = dyn_cast<Command>(&J)) { return ExecuteCommand(*C, FailingCommand); @@ -142,13 +142,13 @@ int Compilation::ExecuteJob(const Job &J, // Piped commands with a single job are easy. if (PJ->size() == 1) return ExecuteCommand(**PJ->begin(), FailingCommand); - + FailingCommand = *PJ->begin(); getDriver().Diag(clang::diag::err_drv_unsupported_opt) << "-pipe"; return 1; } else { const JobList *Jobs = cast<JobList>(&J); - for (JobList::const_iterator + for (JobList::const_iterator it = Jobs->begin(), ie = Jobs->end(); it != ie; ++it) if (int Res = ExecuteJob(**it, FailingCommand)) return Res; |