[lldb] Fix "exact match" debug_names type queries (#118465)
[llvm-project.git] / clang / lib / Interpreter / IncrementalExecutor.h
blobdbd61f0b8b1ebb7d0ec053011795e89e7dd955e7
1 //===--- IncrementalExecutor.h - Incremental Execution ----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the class which performs incremental code execution.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_LIB_INTERPRETER_INCREMENTALEXECUTOR_H
14 #define LLVM_CLANG_LIB_INTERPRETER_INCREMENTALEXECUTOR_H
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
19 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
21 #include <memory>
23 namespace llvm {
24 class Error;
25 namespace orc {
26 class JITTargetMachineBuilder;
27 class LLJIT;
28 class LLJITBuilder;
29 class ThreadSafeContext;
30 } // namespace orc
31 } // namespace llvm
33 namespace clang {
35 struct PartialTranslationUnit;
36 class TargetInfo;
38 class IncrementalExecutor {
39 using CtorDtorIterator = llvm::orc::CtorDtorIterator;
40 std::unique_ptr<llvm::orc::LLJIT> Jit;
41 llvm::orc::ThreadSafeContext &TSCtx;
43 llvm::DenseMap<const PartialTranslationUnit *, llvm::orc::ResourceTrackerSP>
44 ResourceTrackers;
46 protected:
47 IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC);
49 public:
50 enum SymbolNameKind { IRName, LinkerName };
52 IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC,
53 llvm::orc::LLJITBuilder &JITBuilder, llvm::Error &Err);
54 virtual ~IncrementalExecutor();
56 virtual llvm::Error addModule(PartialTranslationUnit &PTU);
57 virtual llvm::Error removeModule(PartialTranslationUnit &PTU);
58 virtual llvm::Error runCtors() const;
59 virtual llvm::Error cleanUp();
60 llvm::Expected<llvm::orc::ExecutorAddr>
61 getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const;
63 llvm::orc::LLJIT &GetExecutionEngine() { return *Jit; }
65 static llvm::Expected<std::unique_ptr<llvm::orc::LLJITBuilder>>
66 createDefaultJITBuilder(llvm::orc::JITTargetMachineBuilder JTMB);
69 } // end namespace clang
71 #endif // LLVM_CLANG_LIB_INTERPRETER_INCREMENTALEXECUTOR_H