Skip to content

Commit d4796fb

Browse files
authored
Escape kore when used as symbol name (#1217)
Closes #1216 by using an escaped string with a prefix `const_` as the symbol name
1 parent 2b55885 commit d4796fb

File tree

3 files changed

+2815
-2
lines changed

3 files changed

+2815
-2
lines changed

lib/codegen/CreateStaticTerm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ llvm::Constant *create_static_term::not_injection_case(
3636

3737
std::stringstream kore_string;
3838
constructor->print(kore_string);
39-
llvm::Constant *block
40-
= module_->getOrInsertGlobal(kore_string.str(), block_type);
39+
llvm::Constant *block = module_->getOrInsertGlobal(
40+
"const_" + escape(kore_string.str()), block_type);
4141
auto *global_var = llvm::dyn_cast<llvm::GlobalVariable>(block);
4242
// this is technically not a constant because functions which return fresh constants
4343
// will mutate a block in this circumstance. Probably best not to rely on this actually

0 commit comments

Comments
 (0)