Allow passing '-###' to ASTUnit::LoadFromCommandLine to print out the cc1 options.

llvm-svn: 127183
This commit is contained in:
Argyrios Kyrtzidis 2011-03-07 22:45:01 +00:00
parent d00c628f8f
commit bc1f48f654
1 changed files with 8 additions and 0 deletions

View File

@ -20,6 +20,8 @@
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/Job.h"
#include "clang/Driver/ArgList.h"
#include "clang/Driver/Options.h"
#include "clang/Driver/Tool.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
@ -1613,6 +1615,12 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin,
llvm::OwningPtr<driver::Compilation> C(
TheDriver.BuildCompilation(Args.size(), Args.data()));
// Just print the cc1 options if -### was present.
if (C->getArgs().hasArg(driver::options::OPT__HASH_HASH_HASH)) {
C->PrintJob(llvm::errs(), C->getJobs(), "\n", true);
return 0;
}
// We expect to get back exactly one command job, if we didn't something
// failed.
const driver::JobList &Jobs = C->getJobs();