22 #include "llvm/Option/ArgList.h" 23 #include "llvm/Support/Host.h" 24 using namespace clang;
30 std::vector<std::string> *CC1Args) {
40 Args.push_back(
"-fsyntax-only");
43 driver::Driver TheDriver(Args[0], llvm::sys::getDefaultTargetTriple(),
54 if (
C->getArgs().hasArg(driver::options::OPT__HASH_HASH_HASH)) {
55 C->getJobs().Print(llvm::errs(),
"\n",
true);
65 bool OffloadCompilation =
false;
66 if (Jobs.
size() > 1) {
67 for (
auto &A :
C->getActions()){
69 if (isa<driver::BindArchAction>(A))
70 A = *A->input_begin();
71 if (isa<driver::OffloadAction>(A)) {
72 OffloadCompilation =
true;
77 if (Jobs.
size() == 0 || !isa<driver::Command>(*Jobs.
begin()) ||
78 (Jobs.
size() > 1 && !OffloadCompilation)) {
80 llvm::raw_svector_ostream OS(Msg);
81 Jobs.
Print(OS,
"; ",
true);
82 Diags->Report(diag::err_fe_expected_compiler_job) << OS.str();
88 Diags->Report(diag::err_fe_expected_clang_command);
94 *CC1Args = {CCArgs.begin(), CCArgs.end()};
95 auto CI = std::make_unique<CompilerInvocation>();
97 !ShouldRecoverOnErorrs)
void createDiagnostics(DiagnosticConsumer *Client=nullptr, bool ShouldOwnClient=true)
Create the diagnostics engine using the invocation's diagnostic options and replace any existing one ...
Compilation * BuildCompilation(ArrayRef< const char *> Args)
BuildCompilation - Construct a compilation object for a command line argument vector.
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
const Tool & getCreator() const
getCreator - Return the Tool which caused the creation of this job.
JobList - A sequence of jobs to perform.
void setCheckInputsExist(bool Value)
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const
Options for controlling the compiler diagnostics engine.
Command - An executable path/name and argument vector to execute.
Dataflow Directional Tag Classes.
static bool CreateFromArgs(CompilerInvocation &Res, ArrayRef< const char *> CommandLineArgs, DiagnosticsEngine &Diags)
Create a compiler invocation from a list of input options.
const llvm::opt::ArgStringList & getArguments() const
std::unique_ptr< CompilerInvocation > createInvocationFromCommandLine(ArrayRef< const char *> Args, IntrusiveRefCntPtr< DiagnosticsEngine > Diags=IntrusiveRefCntPtr< DiagnosticsEngine >(), IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS=nullptr, bool ShouldRecoverOnErrors=false, std::vector< std::string > *CC1Args=nullptr)
createInvocationFromCommandLine - Construct a compiler invocation object for a command line argument ...