#include "DeviceOffload.h"
#include "IncrementalExecutor.h"
#include "IncrementalParser.h"
#include "InterpreterUtils.h"
#ifdef __EMSCRIPTEN__
#include "Wasm.h"
#endif
#include "clang/AST/ASTContext.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/TypeVisitor.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/CodeGen/CodeGenAction.h"
#include "clang/CodeGen/ModuleBuilder.h"
#include "clang/CodeGen/ObjectFilePCHContainerWriter.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/Job.h"
#include "clang/Driver/Options.h"
#include "clang/Driver/Tool.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/TextDiagnosticBuffer.h"
#include "clang/Interpreter/Interpreter.h"
#include "clang/Interpreter/Value.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Sema/Lookup.h"
#include "clang/Serialization/ObjectFilePCHContainerReader.h"
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Host.h"
#include <cstdarg>
usingnamespaceclang;
namespace {
static llvm::Expected<const llvm::opt::ArgStringList *>
GetCC1Arguments(DiagnosticsEngine *Diagnostics,
driver::Compilation *Compilation) { … }
static llvm::Expected<std::unique_ptr<CompilerInstance>>
CreateCI(const llvm::opt::ArgStringList &Argv) { … }
}
llvm::Expected<std::unique_ptr<CompilerInstance>>
IncrementalCompilerBuilder::create(std::string TT,
std::vector<const char *> &ClangArgv) { … }
llvm::Expected<std::unique_ptr<CompilerInstance>>
IncrementalCompilerBuilder::CreateCpp() { … }
llvm::Expected<std::unique_ptr<CompilerInstance>>
IncrementalCompilerBuilder::createCuda(bool device) { … }
llvm::Expected<std::unique_ptr<CompilerInstance>>
IncrementalCompilerBuilder::CreateCudaDevice() { … }
llvm::Expected<std::unique_ptr<CompilerInstance>>
IncrementalCompilerBuilder::CreateCudaHost() { … }
Interpreter::Interpreter(std::unique_ptr<CompilerInstance> CI,
llvm::Error &ErrOut,
std::unique_ptr<llvm::orc::LLJITBuilder> JITBuilder)
: … { … }
Interpreter::~Interpreter() { … }
const char *const Runtimes = …;
llvm::Expected<std::unique_ptr<Interpreter>>
Interpreter::create(std::unique_ptr<CompilerInstance> CI) { … }
llvm::Expected<std::unique_ptr<Interpreter>>
Interpreter::createWithCUDA(std::unique_ptr<CompilerInstance> CI,
std::unique_ptr<CompilerInstance> DCI) { … }
const CompilerInstance *Interpreter::getCompilerInstance() const { … }
CompilerInstance *Interpreter::getCompilerInstance() { … }
llvm::Expected<llvm::orc::LLJIT &> Interpreter::getExecutionEngine() { … }
ASTContext &Interpreter::getASTContext() { … }
const ASTContext &Interpreter::getASTContext() const { … }
void Interpreter::markUserCodeStart() { … }
size_t Interpreter::getEffectivePTUSize() const { … }
llvm::Expected<PartialTranslationUnit &>
Interpreter::Parse(llvm::StringRef Code) { … }
static llvm::Expected<llvm::orc::JITTargetMachineBuilder>
createJITTargetMachineBuilder(const std::string &TT) { … }
llvm::Error Interpreter::CreateExecutor() { … }
void Interpreter::ResetExecutor() { … }
llvm::Error Interpreter::Execute(PartialTranslationUnit &T) { … }
llvm::Error Interpreter::ParseAndExecute(llvm::StringRef Code, Value *V) { … }
llvm::Expected<llvm::orc::ExecutorAddr>
Interpreter::getSymbolAddress(GlobalDecl GD) const { … }
llvm::Expected<llvm::orc::ExecutorAddr>
Interpreter::getSymbolAddress(llvm::StringRef IRName) const { … }
llvm::Expected<llvm::orc::ExecutorAddr>
Interpreter::getSymbolAddressFromLinkerName(llvm::StringRef Name) const { … }
llvm::Error Interpreter::Undo(unsigned N) { … }
llvm::Error Interpreter::LoadDynamicLibrary(const char *name) { … }
llvm::Expected<llvm::orc::ExecutorAddr>
Interpreter::CompileDtorCall(CXXRecordDecl *CXXRD) { … }
static constexpr llvm::StringRef MagicRuntimeInterface[] = …;
static std::unique_ptr<RuntimeInterfaceBuilder>
createInProcessRuntimeInterfaceBuilder(Interpreter &Interp, ASTContext &Ctx,
Sema &S);
std::unique_ptr<RuntimeInterfaceBuilder> Interpreter::FindRuntimeInterface() { … }
namespace {
class InterfaceKindVisitor
: public TypeVisitor<InterfaceKindVisitor, Interpreter::InterfaceKind> { … };
class InProcessRuntimeInterfaceBuilder : public RuntimeInterfaceBuilder { … };
}
static std::unique_ptr<RuntimeInterfaceBuilder>
createInProcessRuntimeInterfaceBuilder(Interpreter &Interp, ASTContext &Ctx,
Sema &S) { … }
Expr *Interpreter::SynthesizeExpr(Expr *E) { … }
REPL_EXTERNAL_VISIBILITY void *
__clang_Interpreter_SetValueWithAlloc(void *This, void *OutVal,
void *OpaqueType) { … }
extern "C" void REPL_EXTERNAL_VISIBILITY __clang_Interpreter_SetValueNoAlloc(
void *This, void *OutVal, void *OpaqueType, ...) { … }
struct __clang_Interpreter_NewTag { … };
REPL_EXTERNAL_VISIBILITY void *
operator new(size_t __sz, void *__p, __clang_Interpreter_NewTag) noexcept { … }