From: Argyrios Kyrtzidis Date: Mon, 7 Mar 2011 22:45:01 +0000 (+0000) Subject: Allow passing '-###' to ASTUnit::LoadFromCommandLine to print out the cc1 options. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e03c2b9d735063a60cd0623423f4814178857ef;p=clang Allow passing '-###' to ASTUnit::LoadFromCommandLine to print out the cc1 options. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127183 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 6644206766..9252c6a7a0 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -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 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();