|
|
|||
File indexing completed on 2026-05-10 08:43:52
0001 //===------ AbsoluteSymbols.h - Absolute symbols utilities ------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // absoluteSymbols function and related utilities. 0010 // 0011 //===----------------------------------------------------------------------===// 0012 0013 #ifndef LLVM_EXECUTIONENGINE_ORC_ABSOLUTESYMBOLS_H 0014 #define LLVM_EXECUTIONENGINE_ORC_ABSOLUTESYMBOLS_H 0015 0016 #include "llvm/ExecutionEngine/Orc/MaterializationUnit.h" 0017 0018 namespace llvm::orc { 0019 0020 /// A MaterializationUnit implementation for pre-existing absolute symbols. 0021 /// 0022 /// All symbols will be resolved and marked ready as soon as the unit is 0023 /// materialized. 0024 class AbsoluteSymbolsMaterializationUnit : public MaterializationUnit { 0025 public: 0026 AbsoluteSymbolsMaterializationUnit(SymbolMap Symbols); 0027 0028 StringRef getName() const override; 0029 0030 private: 0031 void materialize(std::unique_ptr<MaterializationResponsibility> R) override; 0032 void discard(const JITDylib &JD, const SymbolStringPtr &Name) override; 0033 static MaterializationUnit::Interface extractFlags(const SymbolMap &Symbols); 0034 0035 SymbolMap Symbols; 0036 }; 0037 0038 /// Create an AbsoluteSymbolsMaterializationUnit with the given symbols. 0039 /// Useful for inserting absolute symbols into a JITDylib. E.g.: 0040 /// \code{.cpp} 0041 /// JITDylib &JD = ...; 0042 /// SymbolStringPtr Foo = ...; 0043 /// ExecutorSymbolDef FooSym = ...; 0044 /// if (auto Err = JD.define(absoluteSymbols({ 0045 /// { Foo, FooSym }, 0046 /// { Bar, BarSym } 0047 /// }))) 0048 /// return Err; 0049 /// \endcode 0050 /// 0051 inline std::unique_ptr<AbsoluteSymbolsMaterializationUnit> 0052 absoluteSymbols(SymbolMap Symbols) { 0053 return std::make_unique<AbsoluteSymbolsMaterializationUnit>( 0054 std::move(Symbols)); 0055 } 0056 0057 } // namespace llvm::orc 0058 0059 #endif // LLVM_EXECUTIONENGINE_ORC_ABSOLUTESYMBOLS_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|