Skip to content

Commit

Permalink
Prevent name clash of global variable for static variable initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanradanov committed Jul 5, 2022
1 parent e703db1 commit f97add5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/cgeist/Lib/clang-mlir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,9 @@ ValueCategory MLIRScanner::VisitVarDecl(clang::VarDecl *decl) {
auto name = Glob.CGM.getMangledName(decl);
auto globalOp = gbuilder.create<mlir::memref::GlobalOp>(
module->getLoc(),
builder.getStringAttr(function.getName() + "@static@" + name +
"@init"),
builder.getStringAttr(
function.getName() + "@static@" + name + "@init@" +
to_string(reinterpret_cast<long long unsigned int>(decl))),
/*sym_visibility*/ mlir::StringAttr(), mlir::TypeAttr::get(mr),
init_value, mlir::UnitAttr(), /*alignment*/ nullptr);
SymbolTable::setSymbolVisibility(globalOp,
Expand Down

0 comments on commit f97add5

Please sign in to comment.