51#include "llvm/ADT/StringExtras.h"
52#include "llvm/ADT/StringSwitch.h"
53#include "llvm/ExecutionEngine/JITSymbol.h"
54#include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"
55#include "llvm/ExecutionEngine/Orc/LLJIT.h"
56#include "llvm/IR/Module.h"
57#include "llvm/Support/Errc.h"
58#include "llvm/Support/ErrorHandling.h"
59#include "llvm/Support/Process.h"
60#include "llvm/Support/VirtualFileSystem.h"
61#include "llvm/Support/raw_ostream.h"
62#include "llvm/TargetParser/Host.h"
63#include "llvm/TargetParser/Triple.h"
64#include "llvm/Transforms/Utils/Cloning.h"
66#define DEBUG_TYPE "clang-repl"
81 return llvm::createStringError(llvm::errc::not_supported,
82 "Driver initialization failed. "
83 "Unable to create a driver job");
88 return llvm::StringRef(
C.getCreator().getName()) ==
"clang" &&
89 llvm::is_contained(
C.getArguments(),
90 llvm::StringRef(
"-fcuda-is-device"));
92 if (NumDeviceJobs > 1)
93 return llvm::createStringError(
94 llvm::errc::not_supported,
95 "Multiple device architectures are not supported. Pass a single "
101 return llvm::createStringError(llvm::errc::not_supported,
102 "Driver initialization failed");
113 PICLevelReader(
unsigned &PICLevel) : PICLevel(PICLevel) {}
115 bool ReadLanguageOptions(
const LangOptions &LangOpts,
116 StringRef ModuleFilename,
bool Complain,
117 bool AllowCompatibleDifferences)
override {
118 PICLevel = LangOpts.PICLevel;
133 StringRef Filename) {
137 unsigned ASTPICLevel = 0;
138 PICLevelReader Reader(ASTPICLevel);
144 return llvm::createStringError(
145 llvm::errc::not_supported,
146 "AST file '%s' was built with PIC level %u, which is incompatible "
147 "with clang-repl's PIC level %u",
148 Filename.str().c_str(), ASTPICLevel, Clang.
getLangOpts().PICLevel);
149 return llvm::Error::success();
153CreateCI(
const llvm::opt::ArgStringList &Argv) {
158 auto PCHOps = Clang->getPCHContainerOperations();
159 PCHOps->registerWriter(std::make_unique<ObjectFilePCHContainerWriter>());
160 PCHOps->registerReader(std::make_unique<ObjectFilePCHContainerReader>());
168 Clang->getInvocation(),
llvm::ArrayRef(Argv.begin(), Argv.size()), Diags);
171 if (Clang->getHeaderSearchOpts().UseBuiltinIncludes &&
172 Clang->getHeaderSearchOpts().ResourceDir.empty())
173 Clang->getHeaderSearchOpts().ResourceDir =
176 Clang->createVirtualFileSystem();
179 Clang->createDiagnostics();
183 return llvm::createStringError(llvm::errc::not_supported,
184 "Initialization failed. "
185 "Unable to flush diagnostics");
188 llvm::MemoryBuffer *MB = llvm::MemoryBuffer::getMemBuffer(
"").release();
189 Clang->getPreprocessorOpts().addRemappedFile(
"<<< inputs >>>", MB);
192 Clang->getDiagnostics(), Clang->getInvocation().getTargetOpts()));
193 if (!Clang->hasTarget())
194 return llvm::createStringError(llvm::errc::not_supported,
195 "Initialization failed. "
196 "Target is missing");
198 Clang->getTarget().adjust(Clang->getDiagnostics(), Clang->getLangOpts(),
199 Clang->getAuxTarget());
203 Clang->getCodeGenOpts().ClearASTBeforeBackend =
false;
205 Clang->getFrontendOpts().DisableFree =
false;
206 Clang->getCodeGenOpts().DisableFree =
false;
211 StringRef PCHInclude = Clang->getPreprocessorOpts().ImplicitPCHInclude;
212 if (!PCHInclude.empty())
213 if (llvm::Error Err = checkASTFilePICLevel(*Clang, PCHInclude))
214 return std::move(Err);
218 for (StringRef ModuleFile : Clang->getFrontendOpts().ModuleFiles)
219 if (llvm::Error Err = checkASTFilePICLevel(*Clang, ModuleFile))
220 return std::move(Err);
221 for (
const auto &NameAndFile :
222 Clang->getHeaderSearchOpts().PrebuiltModuleFiles)
223 if (llvm::Error Err = checkASTFilePICLevel(*Clang, NameAndFile.second))
224 return std::move(Err);
226 return std::move(Clang);
232 return llvm::createStringError(llvm::errc::not_supported,
233 "Failed to execute incremental action");
235 return llvm::Error::success();
248 Token &FirstToken)
override {
251 if (
Tok.isNot(tok::identifier) ||
252 !
Tok.getIdentifierInfo()->isStr(
"optimize")) {
253 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_identifier)
259 if (
Tok.isNot(tok::l_paren)) {
260 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_lparen)
261 <<
"clang repl optimize";
268 std::optional<std::pair<unsigned, unsigned>> Level =
269 llvm::StringSwitch<std::optional<std::pair<unsigned, unsigned>>>(Opt)
270 .Case(
"O0", std::pair(0
U, 0
U))
271 .Case(
"O1", std::pair(1U, 0
U))
272 .Case(
"O2", std::pair(2U, 0
U))
273 .Case(
"O3", std::pair(3U, 0
U))
274 .Case(
"Os", std::pair(2U, 1U))
275 .Case(
"Oz", std::pair(2U, 2U))
276 .Default(std::nullopt);
278 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_invalid_argument)
279 << Opt <<
"clang repl optimize" <<
true
280 <<
"'O0', 'O1', 'O2', 'O3', 'Os' or 'Oz'";
285 if (
Tok.isNot(tok::r_paren)) {
286 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_rparen)
287 <<
"clang repl optimize";
292 if (
Tok.isNot(tok::eod)) {
293 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
294 <<
"clang repl optimize";
307IncrementalCompilerBuilder::create(std::string TT,
308 std::vector<const char *> &ClangArgv) {
312 std::string MainExecutableName =
313 llvm::sys::fs::getMainExecutable(
nullptr,
nullptr);
315 ClangArgv.insert(ClangArgv.begin(), MainExecutableName.c_str());
329 llvm::Triple TargetTriple(TT);
330 if (!TargetTriple.isOSWindows() || TargetTriple.isOSCygMing())
331 ClangArgv.insert(ClangArgv.begin() + 1,
"-fPIC");
338 ClangArgv.insert(ClangArgv.end(),
"-Xclang");
339 ClangArgv.insert(ClangArgv.end(),
"-fincremental-extensions");
340 ClangArgv.insert(ClangArgv.end(),
"-c");
344 ClangArgv.push_back(
"<<< inputs >>>");
348 std::unique_ptr<DiagnosticOptions> DiagOpts =
350 TextDiagnosticBuffer *DiagsBuffer =
new TextDiagnosticBuffer;
353 driver::Driver
Driver(ClangArgv[0], TT, Diags);
354 Driver.setCheckInputsExist(
false);
355 llvm::ArrayRef<const char *> RF = llvm::ArrayRef(ClangArgv);
356 std::unique_ptr<driver::Compilation> Compilation(
Driver.BuildCompilation(RF));
359 if (
auto Err = (*CompilationCB)(*Compilation.get()))
360 return std::move(Err);
362 if (Compilation->getArgs().hasArg(options::OPT_v))
363 Compilation->getJobs().Print(llvm::errs(),
"\n",
false);
365 auto ErrOrCC1Args = GetCC1Arguments(&Diags, Compilation.get());
366 if (
auto Err = ErrOrCC1Args.takeError())
367 return std::move(Err);
369 return CreateCI(**ErrOrCC1Args);
374 std::string TT = TargetTriple ? *TargetTriple : llvm::sys::getProcessTriple();
376 std::vector<const char *> Argv;
377 Argv.reserve(5 + 1 + UserArgs.size());
378 Argv.push_back(
"-xc++");
380 Argv.push_back(
"-target");
381 Argv.push_back(TT.c_str());
382 Argv.push_back(
"-fvisibility=default");
384 llvm::append_range(Argv, UserArgs);
386 return IncrementalCompilerBuilder::create(TT, Argv);
390IncrementalCompilerBuilder::createOffload(
bool device,
OffloadType Type) {
392 return llvm::make_error<llvm::StringError>(
393 "Detecting the device vendor is not supported yet.",
394 llvm::inconvertibleErrorCode());
397 std::vector<const char *> Argv;
398 Argv.reserve(5 + 4 + UserArgs.size());
399 Argv.push_back(HipEnabled ?
"-xhip" :
"-xcuda");
400 Argv.push_back(device ?
"--cuda-device-only" :
"--cuda-host-only");
402 std::string SDKPathArg = HipEnabled ?
"--rocm-path=" :
"--cuda-path=";
403 if (!DeviceSDKPath.empty()) {
404 SDKPathArg += DeviceSDKPath;
405 Argv.push_back(SDKPathArg.c_str());
408 std::string ArchArg =
"--offload-arch=";
411 Argv.push_back(ArchArg.c_str());
414 if (OffloadCUID.empty())
415 OffloadCUID = llvm::utohexstr(llvm::sys::Process::GetRandomNumber(),
417 std::string CUIDArg =
"-cuid=" + OffloadCUID;
418 Argv.push_back(CUIDArg.c_str());
420 llvm::append_range(Argv, UserArgs);
422 std::string TT = TargetTriple ? *TargetTriple : llvm::sys::getProcessTriple();
423 return IncrementalCompilerBuilder::create(TT, Argv);
428 return IncrementalCompilerBuilder::createOffload(
true,
Type);
433 return IncrementalCompilerBuilder::createOffload(
false,
Type);
438 std::unique_ptr<IncrementalExecutorBuilder> IEB,
439 std::unique_ptr<clang::ASTConsumer> Consumer)
440 : IncrExecutorBuilder(
std::move(IEB)) {
441 CI = std::move(Instance);
442 llvm::ErrorAsOutParameter EAO(&ErrOut);
443 auto LLVMCtx = std::make_unique<llvm::LLVMContext>();
444 TSCtx = std::make_unique<llvm::orc::ThreadSafeContext>(std::move(LLVMCtx));
449 Act = TSCtx->withContextDo([&](llvm::LLVMContext *Ctx) {
450 return std::make_unique<IncrementalAction>(*CI, *Ctx, ErrOut, *
this,
451 std::move(Consumer));
457 if (llvm::Error E = ExecuteIncrementalAction(*CI, *Act)) {
458 ErrOut = joinErrors(std::move(ErrOut), std::move(E));
463 std::make_unique<IncrementalParser>(*CI, Act.get(), ErrOut, PTUs);
468 CI->getPreprocessor().AddPragmaHandler(
"clang",
new PragmaReplHandler(*
this));
470 if (Act->getCodeGen()) {
471 Act->CacheCodeGenModule();
474 if (!CI->getPreprocessorOpts().Includes.empty() ||
475 !CI->getPreprocessorOpts().ImplicitPCHInclude.empty()) {
479 auto M = llvm::CloneModule(*Act->getCachedCodeGenModule());
481 IncrParser->RegisterPTU(
C.getTranslationUnitDecl(), std::move(M));
484 ErrOut = joinErrors(std::move(ErrOut), std::move(Err));
490 if (Act->getCodeGen()) {
494 if (llvm::Error Err =
Execute(PTU)) {
495 ErrOut = joinErrors(std::move(ErrOut), std::move(Err));
503 Act->FinalizeAction();
505 DeviceParser.reset();
507 DeviceAct->FinalizeAction();
509 if (llvm::Error Err = IncrExecutor->cleanUp())
510 llvm::report_fatal_error(
511 llvm::Twine(
"Failed to clean up IncrementalExecutor: ") +
520 #define __CLANG_REPL__ 1
522 #define EXTERN_C extern "C"
523 struct __clang_Interpreter_NewTag{} __ci_newtag;
524 void* operator new(__SIZE_TYPE__, void* __p, __clang_Interpreter_NewTag) noexcept;
525 template <class T, class = T (*)() /*disable for arrays*/>
526 void __clang_Interpreter_SetValueCopyArr(const T* Src, void* Placement, unsigned long Size) {
527 for (unsigned long Idx = 0; Idx < Size; ++Idx)
528 new ((void*)(((T*)Placement) + Idx), __ci_newtag) T(Src[Idx]);
530 template <class T, unsigned long N>
531 void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* Placement, unsigned long Size) {
532 __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
535 #if __STDC_VERSION__ < 199901L
539 #define CI_RESTRICT restrict
540 #define CI_INLINE inline
542 #define EXTERN_C extern
543 EXTERN_C void *memcpy(void *CI_RESTRICT dst, const void *CI_RESTRICT src, __SIZE_TYPE__ n);
544 EXTERN_C CI_INLINE void __clang_Interpreter_SetValueCopyArr(const void* Src, void* Placement, unsigned long Size) {
545 memcpy(Placement, Src, Size);
548 EXTERN_C void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
549 EXTERN_C void __clang_Interpreter_SetValueNoAlloc(void *This, void *OutVal, void *OpaqueType, ...);
553 std::unique_ptr<CompilerInstance> CI,
554 std::unique_ptr<IncrementalExecutorBuilder> IEB ) {
555 llvm::Error Err = llvm::Error::success();
557 auto Interp = std::unique_ptr<Interpreter>(
new Interpreter(
558 std::move(CI), Err, std::move(IEB),
nullptr));
559 if (
auto E = std::move(Err))
564 if (
auto E = Interp->ParseAndExecute(
Runtimes))
567 Interp->markUserCodeStart();
569 return std::move(Interp);
574 std::unique_ptr<CompilerInstance> DCI,
577 return llvm::make_error<llvm::StringError>(
578 "Detecting the device vendor is not supported yet.",
579 llvm::inconvertibleErrorCode());
583 std::make_unique<llvm::vfs::InMemoryFileSystem>();
585 std::make_unique<llvm::vfs::OverlayFileSystem>(
586 llvm::vfs::getRealFileSystem());
587 OverlayVFS->pushOverlay(IMVFS);
588 CI->createVirtualFileSystem(OverlayVFS);
589 CI->createFileManager();
596 std::unique_ptr<Interpreter> Interp = std::move(*InterpOrErr);
598 llvm::Error Err = llvm::Error::success();
600 auto DeviceAct = Interp->TSCtx->withContextDo([&](llvm::LLVMContext *Ctx) {
601 return std::make_unique<IncrementalAction>(*DCI, *Ctx, Err, *Interp);
605 return std::move(Err);
607 Interp->DeviceAct = std::move(DeviceAct);
609 if (llvm::Error E = ExecuteIncrementalAction(*DCI, *Interp->DeviceAct))
613 Interp->DeviceAct->CacheCodeGenModule();
615 Interp->DeviceCI = std::move(DCI);
617 std::unique_ptr<IncrementalDeviceParser> DeviceParser;
619 DeviceParser = std::make_unique<IncrementalHIPDeviceParser>(
620 *Interp->DeviceCI, *Interp->getCompilerInstance(),
621 Interp->DeviceAct.get(), IMVFS, Err, Interp->PTUs);
623 DeviceParser = std::make_unique<IncrementalCUDADeviceParser>(
624 *Interp->DeviceCI, *Interp->getCompilerInstance(),
625 Interp->DeviceAct.get(), IMVFS, Err, Interp->PTUs);
628 return std::move(Err);
630 Interp->DeviceParser = std::move(DeviceParser);
631 return std::move(Interp);
642 return std::move(Err);
645 return *IncrExecutor.get();
650 CGO.OptimizationLevel = OptLevel;
651 CGO.OptimizeSize = OptSize;
664void Interpreter::markUserCodeStart() {
665 assert(!InitPTUSize &&
"We only do this once");
666 InitPTUSize = PTUs.size();
669size_t Interpreter::getEffectivePTUSize()
const {
670 assert(PTUs.size() >= InitPTUSize &&
"empty PTU list?");
671 return PTUs.size() - InitPTUSize;
680 if (
auto E = DeviceTU.takeError())
688 DevicePTU.
TheModule->print(llvm::outs(),
nullptr);
690 llvm::Error Err = DeviceParser->GenerateOffloadBinary();
692 return std::move(Err);
702 return TuOrErr.takeError();
710 LastPTU.
TheModule->print(llvm::outs(),
nullptr);
717 return llvm::make_error<llvm::StringError>(
"Operation failed. "
718 "Execution engine exists",
720 if (!Act->getCodeGen())
721 return llvm::make_error<llvm::StringError>(
"Operation failed. "
722 "No code generator available",
725 if (!IncrExecutorBuilder)
730 IncrExecutorBuilder->LLVMArgs = CI->getFrontendOpts().LLVMArgs;
732 auto ExecutorOrErr = IncrExecutorBuilder->create(*TSCtx, CI->getTarget());
734 IncrExecutor = std::move(*ExecutorOrErr);
736 return ExecutorOrErr.takeError();
742 llvm::dbgs() <<
"execute-ptu "
743 << (llvm::is_contained(PTUs,
T)
744 ? std::distance(PTUs.begin(), llvm::find(PTUs,
T))
746 <<
": [TU=" <<
T.TUPart <<
", M=" <<
T.TheModule.get()
747 <<
" (" <<
T.TheModule->getName() <<
")]\n");
754 if (
auto Err = IncrExecutor->addModule(
T))
757 if (
auto Err = IncrExecutor->runCtors())
760 return llvm::Error::success();
765 auto PTU =
Parse(Code);
767 return PTU.takeError();
769 if (llvm::Error Err =
Execute(*PTU))
772 if (LastValue.isValid()) {
777 *
V = std::move(LastValue);
779 return llvm::Error::success();
785 return llvm::make_error<llvm::StringError>(
"Operation failed. "
786 "No execution engine",
788 llvm::StringRef MangledName = Act->getCodeGen()->GetMangledName(GD);
795 return llvm::make_error<llvm::StringError>(
"Operation failed. "
796 "No execution engine",
805 return llvm::make_error<llvm::StringError>(
"Operation failed. "
806 "No execution engine",
814 if (getEffectivePTUSize() == 0) {
815 return llvm::make_error<llvm::StringError>(
"Operation failed. "
816 "No input left to undo",
818 }
else if (N > getEffectivePTUSize()) {
819 return llvm::make_error<llvm::StringError>(
821 "Operation failed. Wanted to undo {0} inputs, only have {1}.", N,
822 getEffectivePTUSize()),
826 for (
unsigned I = 0; I < N; I++) {
828 if (llvm::Error Err = IncrExecutor->removeModule(PTUs.back()))
832 IncrParser->CleanUpPTU(PTUs.back().TUPart);
835 return llvm::Error::success();
841 return EEOrErr.takeError();
843 return EEOrErr->LoadDynamicLibrary(name);
Defines the clang::ASTContext interface.
Defines the clang::FileManager interface and associated types.
Defines the clang::FrontendAction interface and various convenience abstract classes (clang::ASTFront...
Defines the clang::Preprocessor interface.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Abstract interface for callback invocations by the ASTReader.
static bool readASTFileControlBlock(StringRef Filename, FileManager &FileMgr, const ModuleCache &ModCache, const PCHContainerReader &PCHContainerRdr, bool FindModuleFileExtensions, ASTReaderListener &Listener, bool ValidateDiagnosticOptions, unsigned ClientLoadCapabilities=ARR_ConfigurationMismatch|ARR_OutOfDate)
Read the control block for the named AST file.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
const PCHContainerReader & getPCHContainerReader() const
Return the appropriate PCHContainerReader depending on the current CodeGenOptions.
DiagnosticsEngine & getDiagnostics() const
Get the current diagnostics engine.
FileSystemOptions & getFileSystemOpts()
ASTContext & getASTContext() const
IntrusiveRefCntPtr< llvm::vfs::FileSystem > getVirtualFileSystemPtr() const
bool ExecuteAction(FrontendAction &Act)
ExecuteAction - Execute the provided action against the compiler's CompilerInvocation object.
LangOptions & getLangOpts()
CodeGenOptions & getCodeGenOpts()
static bool CreateFromArgs(CompilerInvocation &Res, ArrayRef< const char * > CommandLineArgs, DiagnosticsEngine &Diags, const char *Argv0=nullptr)
Create a compiler invocation from a list of input options.
static llvm::IntrusiveRefCntPtr< DiagnosticIDs > create()
Options for controlling the compiler diagnostics engine.
Concrete class used by the front-end to report problems and issues.
bool hasErrorOccurred() const
void setSeverity(diag::kind Diag, diag::Severity Map, SourceLocation Loc)
This allows the client to specify that certain warnings are ignored.
Implements support for file system lookup, file system caching, and directory search management.
GlobalDecl - represents a global declaration.
A custom action enabling the incremental processing functionality.
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateCpp()
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateHost(OffloadType Type)
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateDevice(OffloadType Type)
static std::unique_ptr< IncrementalExecutorBuilder > createDefault()
Create the default builder for the platform clangInterpreter is built for.
Provides top-level interfaces for incremental compilation and execution.
llvm::Expected< IncrementalExecutor & > getExecutionEngine()
llvm::Error ParseAndExecute(llvm::StringRef Code, Value *V=nullptr)
static llvm::Expected< std::unique_ptr< Interpreter > > create(std::unique_ptr< CompilerInstance > CI, std::unique_ptr< IncrementalExecutorBuilder > IEB=nullptr)
llvm::Error CreateExecutor()
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddress(GlobalDecl GD) const
void setOptLevel(unsigned OptLevel, unsigned OptSize=0)
Set the optimization level and size used to emit subsequently parsed input.
llvm::Error LoadDynamicLibrary(const char *name)
Link a dynamic library.
llvm::Expected< PartialTranslationUnit & > Parse(llvm::StringRef Code)
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddressFromLinkerName(llvm::StringRef LinkerName) const
Interpreter(std::unique_ptr< CompilerInstance > Instance, llvm::Error &Err, std::unique_ptr< IncrementalExecutorBuilder > IEB=nullptr, std::unique_ptr< clang::ASTConsumer > Consumer=nullptr)
llvm::Error Undo(unsigned N=1)
Undo N previous incremental inputs.
const CompilerInstance * getCompilerInstance() const
static llvm::Expected< std::unique_ptr< Interpreter > > createWithDevice(std::unique_ptr< CompilerInstance > CI, std::unique_ptr< CompilerInstance > DCI, OffloadType Type=OffloadType::Detect)
const ASTContext & getASTContext() const
llvm::Error Execute(PartialTranslationUnit &T)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A processor an offloading action can target.
PragmaHandler - Instances of this interface defined to handle the various pragmas that the language f...
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
void LexUnexpandedToken(Token &Result)
Just like Lex, but disables macro expansion of identifier tokens.
StringRef getSpelling(SourceLocation loc, SmallVectorImpl< char > &buffer, bool *invalid=nullptr) const
Return the 'spelling' of the token at the given location; does not go up to the spelling location or ...
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const
Forwarding function for diagnostics.
Encodes a location in the source.
static TargetInfo * CreateTargetInfo(DiagnosticsEngine &Diags, TargetOptions &Opts)
Construct a target for the given options.
void FlushDiagnostics(DiagnosticsEngine &Diags) const
FlushDiagnostics - Flush the buffered diagnostics to an given diagnostic engine.
Token - This structure provides full information about a lexed token.
The base class of the type hierarchy.
Command - An executable path/name and argument vector to execute.
const Tool & getCreator() const
getCreator - Return the Tool which caused the creation of this job.
const llvm::opt::ArgStringList & getArguments() const
Compilation - A set of tasks to perform for a single driver invocation.
JobList - A sequence of jobs to perform.
Defines the clang::TargetInfo interface.
@ Ignored
Do not present this diagnostic, ignore it.
@ EmitLLVM
Emit a .ll file.
Top level wrappers for InstallAPI frontend operations.
std::unique_ptr< DiagnosticOptions > CreateAndPopulateDiagOpts(ArrayRef< const char * > Argv)
OffloadType
The device language to offload to.
@ Success
Annotation was successful.
std::shared_ptr< ModuleCache > createCrossProcessModuleCache()
Creates new ModuleCache backed by a file system directory that may be operated on by multiple process...
@ Parse
Parse the block; this code is always used.
const char *const Runtimes
const FunctionProtoType * T
std::string GetResourcesPath(StringRef BinaryPath)
Get the directory where the compiler headers reside, relative to the compiler binary path BinaryPath.
bool(*)(llvm::ArrayRef< const char * >, llvm::raw_ostream &, llvm::raw_ostream &, bool, bool) Driver
The class keeps track of various objects created as part of processing incremental inputs.
std::unique_ptr< llvm::Module > TheModule
The llvm IR produced for the input.
Describes how and where the pragma was introduced.