clang 17.0.0git
IncrementalExecutor.h
Go to the documentation of this file.
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.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_INTERPRETER_INCREMENTALEXECUTOR_H
14#define LLVM_CLANG_LIB_INTERPRETER_INCREMENTALEXECUTOR_H
15
16#include "llvm/ADT/DenseMap.h"
17#include "llvm/ADT/StringRef.h"
18#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
19
20#include <memory>
21
22namespace llvm {
23class Error;
24namespace orc {
25class LLJIT;
26class ThreadSafeContext;
27} // namespace orc
28} // namespace llvm
29
30namespace clang {
31
32struct PartialTranslationUnit;
33class TargetInfo;
34
36 using CtorDtorIterator = llvm::orc::CtorDtorIterator;
37 std::unique_ptr<llvm::orc::LLJIT> Jit;
38 llvm::orc::ThreadSafeContext &TSCtx;
39
40 llvm::DenseMap<const PartialTranslationUnit *, llvm::orc::ResourceTrackerSP>
41 ResourceTrackers;
42
43public:
45
46 IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC, llvm::Error &Err,
47 const clang::TargetInfo &TI);
49
50 llvm::Error addModule(PartialTranslationUnit &PTU);
51 llvm::Error removeModule(PartialTranslationUnit &PTU);
52 llvm::Error runCtors() const;
53 llvm::Error cleanUp();
55 getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const;
56 llvm::orc::LLJIT *getExecutionEngine() const { return Jit.get(); }
57};
58
59} // end namespace clang
60
61#endif // LLVM_CLANG_LIB_INTERPRETER_INCREMENTALEXECUTOR_H
llvm::Error Error
llvm::orc::LLJIT * getExecutionEngine() const
llvm::Expected< llvm::JITTargetAddress > getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const
llvm::Error addModule(PartialTranslationUnit &PTU)
llvm::Error removeModule(PartialTranslationUnit &PTU)
Exposes information about the current target.
Definition: TargetInfo.h:206
YAML serialization mapping.
Definition: Dominators.h:30
The class keeps track of various objects created as part of processing incremental inputs.