Skip to content

Commit 4fe47e9

Browse files
committed
LLVMCompilerContext: Add addUsedProcedure() method
1 parent 07bc345 commit 4fe47e9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/engine/internal/llvm/llvmcompilercontext.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ const std::unordered_map<function_id_t, LLVMExecutableCode *> &LLVMCompilerConte
6565
return m_codeMap;
6666
}
6767

68+
void LLVMCompilerContext::addUsedProcedure(const std::string &functionName)
69+
{
70+
m_usedProcedures.insert(functionName);
71+
}
72+
6873
function_id_t LLVMCompilerContext::getNextFunctionId()
6974
{
7075
return m_nextFunctionId++;

src/engine/internal/llvm/llvmcompilercontext.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include <scratchcpp/compilercontext.h>
1010

11+
#include <unordered_set>
12+
1113
namespace libscratchcpp
1214
{
1315

@@ -32,6 +34,8 @@ class LLVMCompilerContext : public CompilerContext
3234
void addCode(LLVMExecutableCode *code);
3335
const std::unordered_map<function_id_t, LLVMExecutableCode *> &codeMap() const;
3436

37+
void addUsedProcedure(const std::string &functionName);
38+
3539
function_id_t getNextFunctionId();
3640

3741
void initJit();
@@ -89,6 +93,8 @@ class LLVMCompilerContext : public CompilerContext
8993
llvm::StructType *m_valueDataType = nullptr;
9094
llvm::StructType *m_stringPtrType = nullptr;
9195
llvm::Type *m_functionIdType = nullptr;
96+
97+
std::unordered_set<std::string> m_usedProcedures;
9298
};
9399

94100
} // namespace libscratchcpp

0 commit comments

Comments
 (0)