diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-18 06:49:39 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-18 06:49:39 +0000 |
commit | 0928b3125cbeaaf5176ca6951df8b5bad2b52e85 (patch) | |
tree | d86e69faf3688a303aa79df93d90b7c1591c6ab5 /clang/lib/Driver/Compilation.cpp | |
parent | 0381128ad9dcc150542cde6bbcc19fffba0f8070 (diff) | |
download | bcm5719-llvm-0928b3125cbeaaf5176ca6951df8b5bad2b52e85.tar.gz bcm5719-llvm-0928b3125cbeaaf5176ca6951df8b5bad2b52e85.zip |
Driver: Implement -### (hard to tell, since we don't actually
construct any jobs).
llvm-svn: 67177
Diffstat (limited to 'clang/lib/Driver/Compilation.cpp')
-rw-r--r-- | clang/lib/Driver/Compilation.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp index 1dcb8d8f6e9..364f3281572 100644 --- a/clang/lib/Driver/Compilation.cpp +++ b/clang/lib/Driver/Compilation.cpp @@ -13,6 +13,7 @@ #include "clang/Driver/ArgList.h" #include "clang/Driver/ToolChain.h" +#include "llvm/Support/raw_ostream.h" using namespace clang::driver; Compilation::Compilation(ToolChain &_DefaultToolChain, @@ -48,6 +49,32 @@ const ArgList &Compilation::getArgsForToolChain(const ToolChain *TC) { return *Entry; } +void Compilation::PrintJob(llvm::raw_ostream &OS, const Job *J, + const char *Terminator) const { + if (const Command *C = dyn_cast<Command>(J)) { + OS << " \"" << C->getExecutable() << '"'; + for (ArgStringList::const_iterator it = C->getArguments().begin(), + ie = C->getArguments().end(); it != ie; ++it) + OS << " \"" << *it << '"'; + OS << Terminator; + } else if (const PipedJob *PJ = dyn_cast<PipedJob>(J)) { + for (PipedJob::const_iterator + it = PJ->begin(), ie = PJ->end(); it != ie; ++it) + PrintJob(OS, *it, (it + 1 != PJ->end()) ? " |\n" : "\n"); + } else { + const JobList *Jobs = cast<JobList>(J); + for (JobList::const_iterator + it = Jobs->begin(), ie = Jobs->end(); it != ie; ++it) + PrintJob(OS, *it, Terminator); + } +} + int Compilation::Execute() const { + // Just print if -### was present. + if (getArgs().hasArg(options::OPT__HASH_HASH_HASH)) { + PrintJob(llvm::errs(), &Jobs, "\n"); + return 0; + } + return 0; } |