23 #include "llvm/Option/ArgList.h"
24 #include "llvm/Support/Host.h"
25 using namespace clang;
26 using namespace llvm::opt;
45 Args.push_back(
"-fsyntax-only");
48 driver::Driver TheDriver(Args[0], llvm::sys::getDefaultTargetTriple(),
57 if (C->getArgs().hasArg(driver::options::OPT__HASH_HASH_HASH)) {
58 C->getJobs().Print(llvm::errs(),
"\n",
true);
68 bool OffloadCompilation =
false;
69 if (Jobs.
size() > 1) {
70 for (
auto &A : C->getActions()){
72 if (isa<driver::BindArchAction>(A))
73 A = *A->input_begin();
74 if (isa<driver::OffloadAction>(A)) {
75 OffloadCompilation =
true;
80 if (Jobs.
size() == 0 || !isa<driver::Command>(*Jobs.
begin()) ||
81 (Jobs.
size() > 1 && !OffloadCompilation)) {
83 llvm::raw_svector_ostream OS(Msg);
84 Jobs.
Print(OS,
"; ",
true);
85 Diags->Report(diag::err_fe_expected_compiler_job) << OS.str();
91 Diags->Report(diag::err_fe_expected_clang_command);
98 const_cast<const char **>(CCArgs.data()),
99 const_cast<const char **>(CCArgs.data()) +
void createDiagnostics(DiagnosticConsumer *Client=nullptr, bool ShouldOwnClient=true)
Create the diagnostics engine using the invocation's diagnostic options and replace any existing one ...
static bool CreateFromArgs(CompilerInvocation &Res, const char *const *ArgBegin, const char *const *ArgEnd, DiagnosticsEngine &Diags)
Create a compiler invocation from a list of input options.
Compilation * BuildCompilation(ArrayRef< const char * > Args)
BuildCompilation - Construct a compilation object for a command line argument vector.
const Tool & getCreator() const
getCreator - Return the Tool which caused the creation of this job.
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
JobList - A sequence of jobs to perform.
void setCheckInputsExist(bool Value)
Options for controlling the compiler diagnostics engine.
Command - An executable path/name and argument vector to execute.
const llvm::opt::ArgStringList & getArguments() const
CompilerInvocation * createInvocationFromCommandLine(ArrayRef< const char * > Args, IntrusiveRefCntPtr< DiagnosticsEngine > Diags=IntrusiveRefCntPtr< DiagnosticsEngine >())
createInvocationFromCommandLine - Construct a compiler invocation object for a command line argument ...
Helper class for holding the data necessary to invoke the compiler.
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const