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");
190 if (Input.isFile() && Input.getFile() ==
"<<< inputs >>>")
194 if (!Clang->createTarget())
195 return llvm::createStringError(llvm::errc::not_supported,
196 "Initialization failed. "
197 "Target is missing");
201 Clang->getCodeGenOpts().ClearASTBeforeBackend =
false;
203 Clang->getFrontendOpts().DisableFree =
false;
204 Clang->getCodeGenOpts().DisableFree =
false;
209 StringRef PCHInclude = Clang->getPreprocessorOpts().ImplicitPCHInclude;
210 if (!PCHInclude.empty())
211 if (llvm::Error Err = checkASTFilePICLevel(*Clang, PCHInclude))
212 return std::move(Err);
216 for (StringRef ModuleFile : Clang->getFrontendOpts().ModuleFiles)
217 if (llvm::Error Err = checkASTFilePICLevel(*Clang, ModuleFile))
218 return std::move(Err);
219 for (
const auto &NameAndFile :
220 Clang->getHeaderSearchOpts().PrebuiltModuleFiles)
221 if (llvm::Error Err = checkASTFilePICLevel(*Clang, NameAndFile.second))
222 return std::move(Err);
224 return std::move(Clang);
232 llvm::raw_string_ostream OS(Msg);
240 return llvm::createStringError(llvm::StringRef(Msg).rtrim());
243 return llvm::createStringError(llvm::errc::not_supported,
244 "Failed to execute incremental action");
246 return llvm::Error::success();
259 Token &FirstToken)
override {
262 if (
Tok.isNot(tok::identifier) ||
263 !
Tok.getIdentifierInfo()->isStr(
"optimize")) {
264 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_identifier)
270 if (
Tok.isNot(tok::l_paren)) {
271 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_lparen)
272 <<
"clang repl optimize";
279 std::optional<std::pair<unsigned, unsigned>> Level =
280 llvm::StringSwitch<std::optional<std::pair<unsigned, unsigned>>>(Opt)
281 .Case(
"O0", std::pair(0
U, 0
U))
282 .Case(
"O1", std::pair(1U, 0
U))
283 .Case(
"O2", std::pair(2U, 0
U))
284 .Case(
"O3", std::pair(3U, 0
U))
285 .Case(
"Os", std::pair(2U, 1U))
286 .Case(
"Oz", std::pair(2U, 2U))
287 .Default(std::nullopt);
289 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_invalid_argument)
290 << Opt <<
"clang repl optimize" <<
true
291 <<
"'O0', 'O1', 'O2', 'O3', 'Os' or 'Oz'";
296 if (
Tok.isNot(tok::r_paren)) {
297 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_expected_rparen)
298 <<
"clang repl optimize";
303 if (
Tok.isNot(tok::eod)) {
304 PP.
Diag(
Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
305 <<
"clang repl optimize";
318IncrementalCompilerBuilder::create(std::string TT,
319 std::vector<const char *> &ClangArgv) {
323 std::string MainExecutableName =
324 llvm::sys::fs::getMainExecutable(
nullptr,
nullptr);
326 ClangArgv.insert(ClangArgv.begin(), MainExecutableName.c_str());
340 llvm::Triple TargetTriple(TT);
341 if (!TargetTriple.isOSWindows() || TargetTriple.isOSCygMing())
342 ClangArgv.insert(ClangArgv.begin() + 1,
"-fPIC");
349 ClangArgv.insert(ClangArgv.end(),
"-Xclang");
350 ClangArgv.insert(ClangArgv.end(),
"-fincremental-extensions");
351 ClangArgv.insert(ClangArgv.end(),
"-c");
355 ClangArgv.push_back(
"<<< inputs >>>");
359 std::unique_ptr<DiagnosticOptions> DiagOpts =
361 TextDiagnosticBuffer *DiagsBuffer =
new TextDiagnosticBuffer;
364 driver::Driver
Driver(ClangArgv[0], TT, Diags);
365 Driver.setCheckInputsExist(
false);
366 llvm::ArrayRef<const char *> RF = llvm::ArrayRef(ClangArgv);
367 std::unique_ptr<driver::Compilation> Compilation(
Driver.BuildCompilation(RF));
370 if (
auto Err = (*CompilationCB)(*Compilation.get()))
371 return std::move(Err);
373 if (Compilation->getArgs().hasArg(options::OPT_v))
374 Compilation->getJobs().Print(llvm::errs(),
"\n",
false);
376 auto ErrOrCC1Args = GetCC1Arguments(&Diags, Compilation.get());
377 if (
auto Err = ErrOrCC1Args.takeError())
378 return std::move(Err);
380 return CreateCI(**ErrOrCC1Args);
385 std::string TT = TargetTriple ? *TargetTriple : llvm::sys::getProcessTriple();
387 std::vector<const char *> Argv;
388 Argv.reserve(5 + 1 + UserArgs.size());
389 Argv.push_back(
"-xc++");
391 Argv.push_back(
"-target");
392 Argv.push_back(TT.c_str());
393 Argv.push_back(
"-fvisibility=default");
395 llvm::append_range(Argv, UserArgs);
397 return IncrementalCompilerBuilder::create(TT, Argv);
401IncrementalCompilerBuilder::createOffload(
bool device,
OffloadType Type) {
403 return llvm::make_error<llvm::StringError>(
404 "Detecting the device vendor is not supported yet.",
405 llvm::inconvertibleErrorCode());
407 constexpr size_t NumDriverArgs = 6;
410 std::vector<const char *> Argv;
411 Argv.reserve(NumDriverArgs + UserArgs.size());
412 Argv.push_back(HipEnabled ?
"-xhip" :
"-xcuda");
413 Argv.push_back(device ?
"--cuda-device-only" :
"--cuda-host-only");
415 std::string SDKPathArg = HipEnabled ?
"--rocm-path=" :
"--cuda-path=";
416 if (!DeviceSDKPath.empty()) {
417 SDKPathArg += DeviceSDKPath;
418 Argv.push_back(SDKPathArg.c_str());
421 std::string ArchArg =
"--offload-arch=";
424 Argv.push_back(ArchArg.c_str());
427 if (OffloadCUID.empty())
428 OffloadCUID = llvm::utohexstr(llvm::sys::Process::GetRandomNumber(),
430 std::string CUIDArg =
"-cuid=" + OffloadCUID;
431 Argv.push_back(CUIDArg.c_str());
435 if (device && HipEnabled)
436 Argv.push_back(
"-O3");
438 llvm::append_range(Argv, UserArgs);
440 std::string TT = TargetTriple ? *TargetTriple : llvm::sys::getProcessTriple();
441 return IncrementalCompilerBuilder::create(TT, Argv);
446 return IncrementalCompilerBuilder::createOffload(
true,
Type);
451 return IncrementalCompilerBuilder::createOffload(
false,
Type);
456 std::unique_ptr<IncrementalExecutorBuilder> IEB,
457 std::unique_ptr<clang::ASTConsumer> Consumer)
458 : IncrExecutorBuilder(
std::move(IEB)) {
459 CI = std::move(Instance);
460 llvm::ErrorAsOutParameter EAO(&ErrOut);
461 auto LLVMCtx = std::make_unique<llvm::LLVMContext>();
462 TSCtx = std::make_unique<llvm::orc::ThreadSafeContext>(std::move(LLVMCtx));
464 Act = TSCtx->withContextDo([&](llvm::LLVMContext *Ctx) {
465 return std::make_unique<IncrementalAction>(*CI, *Ctx, ErrOut, *
this,
466 std::move(Consumer));
472 if (llvm::Error E = ExecuteIncrementalAction(*CI, *Act)) {
473 ErrOut = joinErrors(std::move(ErrOut), std::move(E));
478 std::make_unique<IncrementalParser>(*CI, Act.get(), ErrOut, PTUs);
483 CI->getPreprocessor().AddPragmaHandler(
"clang",
new PragmaReplHandler(*
this));
485 if (Act->getCodeGen()) {
486 Act->CacheCodeGenModule();
489 if (!CI->getPreprocessorOpts().Includes.empty() ||
490 !CI->getPreprocessorOpts().ImplicitPCHInclude.empty()) {
494 auto M = llvm::CloneModule(*Act->getCachedCodeGenModule());
496 IncrParser->RegisterPTU(
C.getTranslationUnitDecl(), std::move(M));
499 ErrOut = joinErrors(std::move(ErrOut), std::move(Err));
505 if (Act->getCodeGen()) {
509 if (llvm::Error Err =
Execute(PTU)) {
510 ErrOut = joinErrors(std::move(ErrOut), std::move(Err));
518 Act->FinalizeAction();
520 DeviceParser.reset();
522 DeviceAct->FinalizeAction();
524 if (llvm::Error Err = IncrExecutor->cleanUp())
525 llvm::report_fatal_error(
526 llvm::Twine(
"Failed to clean up IncrementalExecutor: ") +
535 #define __CLANG_REPL__ 1
537 #define EXTERN_C extern "C"
538 struct __clang_Interpreter_NewTag{} __ci_newtag;
539 void* operator new(__SIZE_TYPE__, void* __p, __clang_Interpreter_NewTag) noexcept;
540 template <class T, class = T (*)() /*disable for arrays*/>
541 void __clang_Interpreter_SetValueCopyArr(const T* Src, void* Placement, unsigned long Size) {
542 for (unsigned long Idx = 0; Idx < Size; ++Idx)
543 new ((void*)(((T*)Placement) + Idx), __ci_newtag) T(Src[Idx]);
545 template <class T, unsigned long N>
546 void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* Placement, unsigned long Size) {
547 __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
550 #if __STDC_VERSION__ < 199901L
554 #define CI_RESTRICT restrict
555 #define CI_INLINE inline
557 #define EXTERN_C extern
558 EXTERN_C void *memcpy(void *CI_RESTRICT dst, const void *CI_RESTRICT src, __SIZE_TYPE__ n);
559 EXTERN_C CI_INLINE void __clang_Interpreter_SetValueCopyArr(const void* Src, void* Placement, unsigned long Size) {
560 memcpy(Placement, Src, Size);
563 EXTERN_C void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
564 EXTERN_C void __clang_Interpreter_SetValueNoAlloc(void *This, void *OutVal, void *OpaqueType, ...);
568 std::unique_ptr<CompilerInstance> CI,
569 std::unique_ptr<IncrementalExecutorBuilder> IEB ) {
570 llvm::Error Err = llvm::Error::success();
572 auto Interp = std::unique_ptr<Interpreter>(
new Interpreter(
573 std::move(CI), Err, std::move(IEB),
nullptr));
574 if (
auto E = std::move(Err))
579 if (
auto E = Interp->ParseAndExecute(
Runtimes))
582 Interp->markUserCodeStart();
584 return std::move(Interp);
589 std::unique_ptr<CompilerInstance> DCI,
592 return llvm::make_error<llvm::StringError>(
593 "Detecting the device vendor is not supported yet.",
594 llvm::inconvertibleErrorCode());
598 std::make_unique<llvm::vfs::InMemoryFileSystem>();
600 std::make_unique<llvm::vfs::OverlayFileSystem>(
601 llvm::vfs::getRealFileSystem());
602 OverlayVFS->pushOverlay(IMVFS);
603 CI->createVirtualFileSystem(OverlayVFS);
604 CI->createFileManager();
611 std::unique_ptr<Interpreter> Interp = std::move(*InterpOrErr);
613 llvm::Error Err = llvm::Error::success();
615 auto DeviceAct = Interp->TSCtx->withContextDo([&](llvm::LLVMContext *Ctx) {
616 return std::make_unique<IncrementalAction>(*DCI, *Ctx, Err, *Interp);
620 return std::move(Err);
622 Interp->DeviceAct = std::move(DeviceAct);
624 if (llvm::Error E = ExecuteIncrementalAction(*DCI, *Interp->DeviceAct))
628 Interp->DeviceAct->CacheCodeGenModule();
630 Interp->DeviceCI = std::move(DCI);
632 std::unique_ptr<IncrementalDeviceParser> DeviceParser;
634 DeviceParser = std::make_unique<IncrementalHIPDeviceParser>(
635 *Interp->DeviceCI, *Interp->getCompilerInstance(),
636 Interp->DeviceAct.get(), IMVFS, Err, Interp->PTUs);
638 DeviceParser = std::make_unique<IncrementalCUDADeviceParser>(
639 *Interp->DeviceCI, *Interp->getCompilerInstance(),
640 Interp->DeviceAct.get(), IMVFS, Err, Interp->PTUs);
643 return std::move(Err);
645 Interp->DeviceParser = std::move(DeviceParser);
646 return std::move(Interp);
657 return std::move(Err);
660 return *IncrExecutor.get();
665 CGO.OptimizationLevel = OptLevel;
666 CGO.OptimizeSize = OptSize;
679void Interpreter::markUserCodeStart() {
680 assert(!InitPTUSize &&
"We only do this once");
681 InitPTUSize = PTUs.size();
684size_t Interpreter::getEffectivePTUSize()
const {
685 assert(PTUs.size() >= InitPTUSize &&
"empty PTU list?");
686 return PTUs.size() - InitPTUSize;
695 if (
auto E = DeviceTU.takeError())
703 DevicePTU.
TheModule->print(llvm::outs(),
nullptr);
705 llvm::Error Err = DeviceParser->GenerateOffloadBinary();
707 return std::move(Err);
717 return TuOrErr.takeError();
725 LastPTU.
TheModule->print(llvm::outs(),
nullptr);
732 return llvm::make_error<llvm::StringError>(
"Operation failed. "
733 "Execution engine exists",
735 if (!Act->getCodeGen())
736 return llvm::make_error<llvm::StringError>(
"Operation failed. "
737 "No code generator available",
740 if (!IncrExecutorBuilder)
743 auto ExecutorOrErr = IncrExecutorBuilder->create(*TSCtx, CI->getTarget());
745 IncrExecutor = std::move(*ExecutorOrErr);
747 return ExecutorOrErr.takeError();
753 llvm::dbgs() <<
"execute-ptu "
754 << (llvm::is_contained(PTUs,
T)
755 ? std::distance(PTUs.begin(), llvm::find(PTUs,
T))
757 <<
": [TU=" <<
T.TUPart <<
", M=" <<
T.TheModule.get()
758 <<
" (" <<
T.TheModule->getName() <<
")]\n");
765 if (
auto Err = IncrExecutor->addModule(
T))
768 if (
auto Err = IncrExecutor->runCtors())
771 return llvm::Error::success();
776 auto PTU =
Parse(Code);
778 return PTU.takeError();
780 if (llvm::Error Err =
Execute(*PTU))
783 if (LastValue.isValid()) {
788 *
V = std::move(LastValue);
790 return llvm::Error::success();
796 return llvm::make_error<llvm::StringError>(
"Operation failed. "
797 "No execution engine",
799 llvm::StringRef MangledName = Act->getCodeGen()->GetMangledName(GD);
806 return llvm::make_error<llvm::StringError>(
"Operation failed. "
807 "No execution engine",
816 return llvm::make_error<llvm::StringError>(
"Operation failed. "
817 "No execution engine",
825 if (getEffectivePTUSize() == 0) {
826 return llvm::make_error<llvm::StringError>(
"Operation failed. "
827 "No input left to undo",
829 }
else if (N > getEffectivePTUSize()) {
830 return llvm::make_error<llvm::StringError>(
832 "Operation failed. Wanted to undo {0} inputs, only have {1}.", N,
833 getEffectivePTUSize()),
837 for (
unsigned I = 0; I < N; I++) {
839 if (llvm::Error Err = IncrExecutor->removeModule(PTUs.back()))
843 IncrParser->CleanUpPTU(PTUs.back().TUPart);
846 return llvm::Error::success();
852 return EEOrErr.takeError();
854 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.
bool parseLLVMArgs(llvm::raw_ostream *Errs=nullptr)
Parse the -mllvm options in FrontendOptions::LLVMArgs, setting library options in getLibraryOptions()...
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
PreprocessorOptions & getPreprocessorOpts()
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...
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
bool RetainRemappedFileBuffers
Whether the compiler instance should retain (i.e., not free) the buffers associated with remapped fil...
void clearRemappedFiles()
std::vector< std::pair< std::string, llvm::MemoryBuffer * > > RemappedFileBuffers
The set of file-to-buffer remappings, which take existing files on the system (the first part of each...
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.
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.