42#include "llvm/ExecutionEngine/JITSymbol.h"
43#include "llvm/ExecutionEngine/Orc/LLJIT.h"
44#include "llvm/IR/Module.h"
45#include "llvm/Support/Errc.h"
46#include "llvm/Support/ErrorHandling.h"
47#include "llvm/Support/raw_ostream.h"
48#include "llvm/TargetParser/Host.h"
65 if (!Jobs.
size() || !isa<driver::Command>(*Jobs.
begin()))
66 return llvm::createStringError(llvm::errc::not_supported,
67 "Driver initialization failed. "
68 "Unable to create a driver job");
72 if (llvm::StringRef(
Cmd->getCreator().getName()) !=
"clang")
73 return llvm::createStringError(llvm::errc::not_supported,
74 "Driver initialization failed");
76 return &
Cmd->getArguments();
80CreateCI(
const llvm::opt::ArgStringList &Argv) {
86 auto PCHOps = Clang->getPCHContainerOperations();
87 PCHOps->registerWriter(std::make_unique<ObjectFilePCHContainerWriter>());
88 PCHOps->registerReader(std::make_unique<ObjectFilePCHContainerReader>());
96 Clang->getInvocation(),
llvm::ArrayRef(Argv.begin(), Argv.size()), Diags);
99 if (Clang->getHeaderSearchOpts().UseBuiltinIncludes &&
100 Clang->getHeaderSearchOpts().ResourceDir.empty())
101 Clang->getHeaderSearchOpts().ResourceDir =
105 Clang->createDiagnostics();
106 if (!Clang->hasDiagnostics())
107 return llvm::createStringError(llvm::errc::not_supported,
108 "Initialization failed. "
109 "Unable to create diagnostics engine");
113 return llvm::createStringError(llvm::errc::not_supported,
114 "Initialization failed. "
115 "Unable to flush diagnostics");
118 llvm::MemoryBuffer *MB = llvm::MemoryBuffer::getMemBuffer(
"").release();
119 Clang->getPreprocessorOpts().addRemappedFile(
"<<< inputs >>>", MB);
122 Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
123 if (!Clang->hasTarget())
124 return llvm::createStringError(llvm::errc::not_supported,
125 "Initialization failed. "
126 "Target is missing");
128 Clang->getTarget().adjust(Clang->getDiagnostics(), Clang->getLangOpts());
132 Clang->getCodeGenOpts().ClearASTBeforeBackend =
false;
134 Clang->getFrontendOpts().DisableFree =
false;
135 Clang->getCodeGenOpts().DisableFree =
false;
136 return std::move(Clang);
142IncrementalCompilerBuilder::create(std::string TT,
143 std::vector<const char *> &ClangArgv) {
147 std::string MainExecutableName =
148 llvm::sys::fs::getMainExecutable(
nullptr,
nullptr);
150 ClangArgv.insert(ClangArgv.begin(), MainExecutableName.c_str());
157 ClangArgv.insert(ClangArgv.end(),
"-Xclang");
158 ClangArgv.insert(ClangArgv.end(),
"-fincremental-extensions");
159 ClangArgv.insert(ClangArgv.end(),
"-c");
163 ClangArgv.push_back(
"<<< inputs >>>");
174 Driver.setCheckInputsExist(
false);
176 std::unique_ptr<driver::Compilation> Compilation(Driver.BuildCompilation(RF));
178 if (Compilation->
getArgs().hasArg(driver::options::OPT_v))
179 Compilation->
getJobs().
Print(llvm::errs(),
"\n",
false);
181 auto ErrOrCC1Args = GetCC1Arguments(&Diags, Compilation.get());
182 if (
auto Err = ErrOrCC1Args.takeError())
183 return std::move(Err);
185 return CreateCI(**ErrOrCC1Args);
190 std::vector<const char *> Argv;
191 Argv.reserve(5 + 1 + UserArgs.size());
192 Argv.push_back(
"-xc++");
194 Argv.push_back(
"-target");
195 Argv.push_back(
"wasm32-unknown-emscripten");
196 Argv.push_back(
"-pie");
197 Argv.push_back(
"-shared");
199 Argv.insert(Argv.end(), UserArgs.begin(), UserArgs.end());
201 std::string TT = TargetTriple ? *TargetTriple : llvm::sys::getProcessTriple();
202 return IncrementalCompilerBuilder::create(TT, Argv);
206IncrementalCompilerBuilder::createCuda(
bool device) {
207 std::vector<const char *> Argv;
208 Argv.reserve(5 + 4 + UserArgs.size());
210 Argv.push_back(
"-xcuda");
212 Argv.push_back(
"--cuda-device-only");
214 Argv.push_back(
"--cuda-host-only");
216 std::string SDKPathArg =
"--cuda-path=";
217 if (!CudaSDKPath.empty()) {
218 SDKPathArg += CudaSDKPath;
219 Argv.push_back(SDKPathArg.c_str());
222 std::string ArchArg =
"--offload-arch=";
225 Argv.push_back(ArchArg.c_str());
228 Argv.insert(Argv.end(), UserArgs.begin(), UserArgs.end());
230 std::string TT = TargetTriple ? *TargetTriple : llvm::sys::getProcessTriple();
231 return IncrementalCompilerBuilder::create(TT, Argv);
236 return IncrementalCompilerBuilder::createCuda(
true);
241 return IncrementalCompilerBuilder::createCuda(
false);
246 std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder)
247 : JITBuilder(
std::move(JITBuilder)) {
248 llvm::ErrorAsOutParameter EAO(&ErrOut);
249 auto LLVMCtx = std::make_unique<llvm::LLVMContext>();
250 TSCtx = std::make_unique<llvm::orc::ThreadSafeContext>(std::move(LLVMCtx));
251 IncrParser = std::make_unique<IncrementalParser>(
252 *
this, std::move(CI), *TSCtx->getContext(), ErrOut);
257 if (IncrParser->getCodeGen()) {
259 ErrOut = joinErrors(std::move(ErrOut), std::move(Err));
266 if (llvm::Error Err =
Execute(PTU)) {
267 ErrOut = joinErrors(std::move(ErrOut), std::move(Err));
275 if (llvm::Error Err = IncrExecutor->cleanUp())
276 llvm::report_fatal_error(
277 llvm::Twine(
"Failed to clean up IncrementalExecutor: ") +
286 #define __CLANG_REPL__ 1
288 #define EXTERN_C extern "C"
289 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
290 struct __clang_Interpreter_NewTag{} __ci_newtag;
291 void* operator new(__SIZE_TYPE__, void* __p, __clang_Interpreter_NewTag) noexcept;
292 template <class T, class = T (*)() /*disable for arrays*/>
293 void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned long Size) {
294 for (auto Idx = 0; Idx < Size; ++Idx)
295 new ((void*)(((T*)Placement) + Idx), __ci_newtag) T(Src[Idx]);
297 template <class T, unsigned long N>
298 void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* Placement, unsigned long Size) {
299 __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
302 #define EXTERN_C extern
305 EXTERN_C void __clang_Interpreter_SetValueNoAlloc(void *This, void *OutVal, void *OpaqueType, ...);
310 llvm::Error Err = llvm::Error::success();
312 std::unique_ptr<Interpreter>(
new Interpreter(std::move(CI), Err));
314 return std::move(Err);
320 return PTU.takeError();
321 Interp->markUserCodeStart();
323 Interp->ValuePrintingInfo.resize(4);
324 return std::move(Interp);
329 std::unique_ptr<CompilerInstance> DCI) {
332 std::make_unique<llvm::vfs::InMemoryFileSystem>();
334 std::make_unique<llvm::vfs::OverlayFileSystem>(
335 llvm::vfs::getRealFileSystem());
336 OverlayVFS->pushOverlay(IMVFS);
337 CI->createFileManager(OverlayVFS);
340 if (
auto E = Interp.takeError())
343 llvm::Error Err = llvm::Error::success();
344 auto DeviceParser = std::make_unique<IncrementalCUDADeviceParser>(
345 **Interp, std::move(DCI), *(*Interp)->IncrParser.get(),
346 *(*Interp)->TSCtx->getContext(), IMVFS, Err);
348 return std::move(Err);
350 (*Interp)->DeviceParser = std::move(DeviceParser);
356 return IncrParser->getCI();
360 return IncrParser->getCI();
366 return std::move(Err);
369 return IncrExecutor->GetExecutionEngine();
380void Interpreter::markUserCodeStart() {
381 assert(!InitPTUSize &&
"We only do this once");
382 InitPTUSize = IncrParser->getPTUs().size();
385size_t Interpreter::getEffectivePTUSize()
const {
386 std::list<PartialTranslationUnit> &PTUs = IncrParser->getPTUs();
387 assert(PTUs.size() >= InitPTUSize &&
"empty PTU list?");
388 return PTUs.size() - InitPTUSize;
396 auto DevicePTU = DeviceParser->Parse(Code);
397 if (
auto E = DevicePTU.takeError())
405 return IncrParser->Parse(Code);
410 if (TT == llvm::sys::getProcessTriple())
412 return llvm::orc::JITTargetMachineBuilder::detectHost();
415 return llvm::orc::JITTargetMachineBuilder(llvm::Triple(TT));
420 return llvm::make_error<llvm::StringError>(
"Operation failed. "
421 "Execution engine exists",
423 if (!IncrParser->getCodeGen())
424 return llvm::make_error<llvm::StringError>(
"Operation failed. "
425 "No code generator available",
431 return JTMB.takeError();
434 return JB.takeError();
435 JITBuilder = std::move(*JB);
438 llvm::Error Err = llvm::Error::success();
440 auto Executor = std::make_unique<WasmIncrementalExecutor>(*TSCtx);
443 std::make_unique<IncrementalExecutor>(*TSCtx, *JITBuilder, Err);
446 IncrExecutor = std::move(Executor);
461 if (
auto Err = IncrExecutor->addModule(
T))
464 if (
auto Err = IncrExecutor->runCtors())
467 return llvm::Error::success();
472 auto PTU =
Parse(Code);
474 return PTU.takeError();
476 if (llvm::Error Err =
Execute(*PTU))
484 *
V = std::move(LastValue);
486 return llvm::Error::success();
492 return llvm::make_error<llvm::StringError>(
"Operation failed. "
493 "No execution engine",
495 llvm::StringRef MangledName = IncrParser->GetMangledName(GD);
502 return llvm::make_error<llvm::StringError>(
"Operation failed. "
503 "No execution engine",
512 return llvm::make_error<llvm::StringError>(
"Operation failed. "
513 "No execution engine",
521 std::list<PartialTranslationUnit> &PTUs = IncrParser->getPTUs();
522 if (N > getEffectivePTUSize())
523 return llvm::make_error<llvm::StringError>(
"Operation failed. "
526 for (
unsigned I = 0; I < N; I++) {
528 if (llvm::Error Err = IncrExecutor->removeModule(PTUs.back()))
532 IncrParser->CleanUpPTU(PTUs.back());
535 return llvm::Error::success();
541 return EE.takeError();
543 auto &DL = EE->getDataLayout();
545 if (
auto DLSG = llvm::orc::DynamicLibrarySearchGenerator::Load(
546 name, DL.getGlobalPrefix()))
547 EE->getMainJITDylib().addGenerator(std::move(*DLSG));
549 return DLSG.takeError();
551 return llvm::Error::success();
556 assert(CXXRD &&
"Cannot compile a destructor for a nullptr");
557 if (
auto Dtor = Dtors.find(CXXRD); Dtor != Dtors.end())
558 return Dtor->getSecond();
561 return llvm::orc::ExecutorAddr{};
566 llvm::StringRef Name =
570 return AddrOrErr.takeError();
572 Dtors[CXXRD] = *AddrOrErr;
577 "__clang_Interpreter_SetValueNoAlloc",
578 "__clang_Interpreter_SetValueWithAlloc",
579 "__clang_Interpreter_SetValueCopyArr",
"__ci_newtag"};
581static std::unique_ptr<RuntimeInterfaceBuilder>
586 if (llvm::all_of(ValuePrintingInfo, [](
Expr *
E) {
return E !=
nullptr; }))
592 auto LookupInterface = [&](
Expr *&
Interface, llvm::StringRef Name) {
595 RedeclarationKind::ForVisibleRedeclaration);
605 if (!LookupInterface(ValuePrintingInfo[
NoAlloc],
609 if (!LookupInterface(ValuePrintingInfo[
WithAlloc],
612 if (!LookupInterface(ValuePrintingInfo[
CopyArray],
615 if (!LookupInterface(ValuePrintingInfo[
NewTag],
625class InterfaceKindVisitor
626 :
public TypeVisitor<InterfaceKindVisitor, Interpreter::InterfaceKind> {
627 friend class InProcessRuntimeInterfaceBuilder;
636 : Ctx(Ctx), S(S),
E(
E) {}
639 return Interpreter::InterfaceKind::WithAlloc;
644 return Interpreter::InterfaceKind::WithAlloc;
649 return Interpreter::InterfaceKind::CopyArray;
655 return Interpreter::InterfaceKind::NoAlloc;
660 return Interpreter::InterfaceKind::NoAlloc;
665 assert(!AddrOfE.
isInvalid() &&
"Can not create unary expression");
666 Args.push_back(AddrOfE.
get());
667 return Interpreter::InterfaceKind::NoAlloc;
676 HandleIntegralOrEnumType(Ty);
681 return Interpreter::InterfaceKind::NoAlloc;
685 HandleIntegralOrEnumType(Ty);
686 return Interpreter::InterfaceKind::NoAlloc;
692 void HandleIntegralOrEnumType(
const Type *Ty) {
698 assert(!CastedExpr.
isInvalid() &&
"Cannot create cstyle cast expr");
699 Args.push_back(CastedExpr.
get());
702 void HandlePtrType(
const Type *Ty) {
706 assert(!CastedExpr.
isInvalid() &&
"Can not create cstyle cast expression");
707 Args.push_back(CastedExpr.
get());
718 : Interp(Interp), Ctx(
C), S(S) {}
720 TransformExprFunction *getPrintValueTransformer()
override {
721 return &transformForValuePrinting;
728 auto *B =
static_cast<InProcessRuntimeInterfaceBuilder *
>(Builder);
731 if (
auto *EWC = llvm::dyn_cast_if_present<ExprWithCleanups>(
E))
732 E = EWC->getSubExpr();
734 InterfaceKindVisitor Visitor(B->Ctx, B->S,
E);
737 for (
Expr *
E : FixedArgs)
738 Visitor.Args.push_back(
E);
745 DesugaredTy = B->Ctx.getLValueReferenceType(DesugaredTy);
746 Ty = B->Ctx.getLValueReferenceType(Ty);
752 Visitor.Args.push_back(TypeArg);
758 case Interpreter::InterfaceKind::WithAlloc:
759 case Interpreter::InterfaceKind::CopyArray: {
764 .getValuePrintingInfo()[Interpreter::InterfaceKind::WithAlloc],
766 assert(!AllocCall.
isInvalid() &&
"Can't create runtime interface call!");
773 auto *Dtor = B->S.LookupDestructor(RD);
774 Dtor->addAttr(UsedAttr::CreateImplicit(B->Ctx));
775 B->Interp.getCompilerInstance()->getASTConsumer().HandleTopLevelDecl(
780 if (
Kind == Interpreter::InterfaceKind::CopyArray) {
781 const auto *ConstantArrTy =
782 cast<ConstantArrayType>(DesugaredTy.
getTypePtr());
783 size_t ArrSize = B->Ctx.getConstantArrayElementCount(ConstantArrTy);
785 Expr *Args[] = {
E, AllocCall.
get(), ArrSizeExpr};
786 return B->S.ActOnCallExpr(
789 .getValuePrintingInfo()[Interpreter::InterfaceKind::CopyArray],
794 B->Interp.getValuePrintingInfo()[Interpreter::InterfaceKind::NewTag]};
803 "Can't create runtime placement new call!");
805 return B->S.ActOnFinishFullExpr(CXXNewCall.
get(),
809 case Interpreter::InterfaceKind::NoAlloc: {
810 return B->S.ActOnCallExpr(
812 B->Interp.getValuePrintingInfo()[Interpreter::InterfaceKind::NoAlloc],
816 llvm_unreachable(
"Unhandled Interpreter::InterfaceKind");
822static std::unique_ptr<RuntimeInterfaceBuilder>
825 return std::make_unique<InProcessRuntimeInterfaceBuilder>(Interp, Ctx, S);
848 AddPrintValueCall = RuntimeIB->getPrintValueTransformer();
851 assert(AddPrintValueCall &&
852 "We don't have a runtime interface for pretty print!");
862 AddPrintValueCall(RuntimeIB.get(),
E, {ThisInterp, OutValue});
880 void *This,
void *OutVal,
void *OpaqueType, ...) {
883 VRef =
Value(I, OpaqueType);
895 QT = ET->getDecl()->getIntegerType();
898 llvm_unreachable(
"unknown type kind!");
901 case BuiltinType::Bool:
902 VRef.setBool(
va_arg(args,
int));
904 case BuiltinType::Char_S:
905 VRef.setChar_S(
va_arg(args,
int));
907 case BuiltinType::SChar:
908 VRef.setSChar(
va_arg(args,
int));
910 case BuiltinType::Char_U:
911 VRef.setChar_U(
va_arg(args,
unsigned));
913 case BuiltinType::UChar:
914 VRef.setUChar(
va_arg(args,
unsigned));
916 case BuiltinType::Short:
917 VRef.setShort(
va_arg(args,
int));
919 case BuiltinType::UShort:
920 VRef.setUShort(
va_arg(args,
unsigned));
922 case BuiltinType::Int:
923 VRef.setInt(
va_arg(args,
int));
925 case BuiltinType::UInt:
926 VRef.setUInt(
va_arg(args,
unsigned));
928 case BuiltinType::Long:
929 VRef.setLong(
va_arg(args,
long));
931 case BuiltinType::ULong:
932 VRef.setULong(
va_arg(args,
unsigned long));
934 case BuiltinType::LongLong:
935 VRef.setLongLong(
va_arg(args,
long long));
937 case BuiltinType::ULongLong:
938 VRef.setULongLong(
va_arg(args,
unsigned long long));
941 case BuiltinType::Float:
942 VRef.setFloat(
va_arg(args,
double));
944 case BuiltinType::Double:
945 VRef.setDouble(
va_arg(args,
double));
947 case BuiltinType::LongDouble:
948 VRef.setLongDouble(
va_arg(args,
long double));
965 return operator new(__sz,
__p);
Defines the clang::ASTContext interface.
enum clang::sema::@1655::IndirectLocalPathEntry::EntryKind Kind
#define REPL_EXTERNAL_VISIBILITY
static std::unique_ptr< RuntimeInterfaceBuilder > createInProcessRuntimeInterfaceBuilder(Interpreter &Interp, ASTContext &Ctx, Sema &S)
const char *const Runtimes
REPL_EXTERNAL_VISIBILITY void * __clang_Interpreter_SetValueWithAlloc(void *This, void *OutVal, void *OpaqueType)
void REPL_EXTERNAL_VISIBILITY __clang_Interpreter_SetValueNoAlloc(void *This, void *OutVal, void *OpaqueType,...)
static constexpr llvm::StringRef MagicRuntimeInterface[]
static llvm::Expected< llvm::orc::JITTargetMachineBuilder > createJITTargetMachineBuilder(const std::string &TT)
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
#define va_start(ap, param)
__builtin_va_list va_list
static __inline__ uint32_t volatile uint32_t * __p
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
const LangOptions & getLangOpts() const
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
QualType getBitIntType(bool Unsigned, unsigned NumBits) const
Return a bit-precise integer type with the specified signedness and bit count.
This class is used for builtin types like 'int'.
Represents a C++ destructor within a class.
Represents a C++ struct/union/class.
bool hasIrrelevantDestructor() const
Determine whether this class has a destructor which has no semantic effect.
Represents a C++ nested-name-specifier or a global scope specifier.
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
DiagnosticsEngine & getDiagnostics() const
Get the current diagnostics engine.
ASTContext & getASTContext() const
TargetOptions & getTargetOpts()
static std::string GetResourcesPath(const char *Argv0, void *MainAddr)
Get the directory where the compiler headers reside, relative to the compiler binary (found by the pa...
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.
Represents the canonical version of C arrays with a specified constant size.
Used for handling and querying diagnostic IDs.
Options for controlling the compiler diagnostics engine.
Concrete class used by the front-end to report problems and issues.
void setSeverity(diag::kind Diag, diag::Severity Map, SourceLocation Loc)
This allows the client to specify that certain warnings are ignored.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
This represents one expression.
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language.
Represents a prototype with parameter type info, e.g.
GlobalDecl - represents a global declaration.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateCudaHost()
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateCpp()
llvm::Expected< std::unique_ptr< CompilerInstance > > CreateCudaDevice()
static llvm::Expected< std::unique_ptr< llvm::orc::LLJITBuilder > > createDefaultJITBuilder(llvm::orc::JITTargetMachineBuilder JTMB)
Provides top-level interfaces for incremental compilation and execution.
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddress(GlobalDecl GD) const
llvm::Error Execute(PartialTranslationUnit &T)
llvm::Expected< llvm::orc::LLJIT & > getExecutionEngine()
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddressFromLinkerName(llvm::StringRef LinkerName) const
static llvm::Expected< std::unique_ptr< Interpreter > > createWithCUDA(std::unique_ptr< CompilerInstance > CI, std::unique_ptr< CompilerInstance > DCI)
const CompilerInstance * getCompilerInstance() const
llvm::Expected< llvm::orc::ExecutorAddr > CompileDtorCall(CXXRecordDecl *CXXRD)
llvm::Error LoadDynamicLibrary(const char *name)
Link a dynamic library.
virtual std::unique_ptr< RuntimeInterfaceBuilder > FindRuntimeInterface()
llvm::Error ParseAndExecute(llvm::StringRef Code, Value *V=nullptr)
Expr * SynthesizeExpr(Expr *E)
llvm::Error CreateExecutor()
Interpreter(std::unique_ptr< CompilerInstance > CI, llvm::Error &Err, std::unique_ptr< llvm::orc::LLJITBuilder > JITBuilder=nullptr)
static llvm::Expected< std::unique_ptr< Interpreter > > create(std::unique_ptr< CompilerInstance > CI)
llvm::Expected< PartialTranslationUnit & > Parse(llvm::StringRef Code)
llvm::Error Undo(unsigned N=1)
Undo N previous incremental inputs.
const ASTContext & getASTContext() const
Represents the results of name lookup.
bool empty() const
Return true if no decls were found.
A pointer to member type per C++ 8.3.3 - Pointers to members.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
void * getAsOpaquePtr() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Base for LValueReferenceType and RValueReferenceType.
Generate glue code between the Interpreter's built-in runtime and user code.
Sema - This implements semantic analysis and AST building for C.
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr, bool IsAfterAmp=false)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEndLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
static TargetInfo * CreateTargetInfo(DiagnosticsEngine &Diags, const std::shared_ptr< TargetOptions > &Opts)
Construct a target for the given options.
std::string Triple
The name of the target triple to compile for.
void FlushDiagnostics(DiagnosticsEngine &Diags) const
FlushDiagnostics - Flush the buffered diagnostics to an given diagnostic engine.
A container of type source information.
QualType getType() const
Return the type wrapped by this type source info.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
const T * castAs() const
Member-template castAs<specific type>.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isFloatingType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isNullPtrType() const
bool isRecordType() const
Command - An executable path/name and argument vector to execute.
Compilation - A set of tasks to perform for a single driver invocation.
const llvm::opt::DerivedArgList & getArgs() const
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
JobList - A sequence of jobs to perform.
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote, CrashReportInfo *CrashInfo=nullptr) const
Defines the clang::TargetInfo interface.
@ Ignored
Do not present this diagnostic, ignore it.
The JSON file list parser is used to communicate input to InstallAPI.
std::unique_ptr< DiagnosticOptions > CreateAndPopulateDiagOpts(ArrayRef< const char * > Argv)
@ Result
The result type of a method or function.
IntegerLiteral * IntegerLiteralExpr(ASTContext &C, uint64_t Val)
@ Dtor_Base
Base object dtor.
const FunctionProtoType * T
Expr * CStyleCastPtrExpr(Sema &S, QualType Ty, Expr *E)
@ Success
Template argument deduction was successful.
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
The class keeps track of various objects created as part of processing incremental inputs.