From 39e50838bd12057d9305575f50c63990984df01a Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sat, 17 Oct 2026 09:15:18 +0000 Subject: feat(codegen): GLOBAL variables as LLVM globals Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/ConstantGen.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/ConstantGen.cc') diff --git a/lib/CodeGen/ConstantGen.cc b/lib/CodeGen/ConstantGen.cc index 632502d..6e1ec57 100644 --- a/lib/CodeGen/ConstantGen.cc +++ b/lib/CodeGen/ConstantGen.cc @@ -35,11 +35,11 @@ bool CodeGen::prepareSymbolDeclaration(const std::string &Name, bool IsConstant) auto &Scope = ConstantScopes.back(); auto It = Symbols.find(Name); if (It != Symbols.end()) { - if (It->second.ScopeID == Scope.ID) { + if (It->second.ScopeID == Scope.ID && !It->second.IsGlobal) { reportError("Declaration of %s conflicts with an existing declaration in this scope", Name.c_str()); return false; } - if (IsConstant || It->second.ConstantValue) Scope.Saved.emplace(Name, It->second); + if (IsConstant || It->second.ConstantValue || It->second.IsGlobal) Scope.Saved.emplace(Name, It->second); } else if (IsConstant) { Scope.Saved.emplace(Name, std::nullopt); } -- cgit v1.3.1-4-g156e