diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 09:15:18 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 09:15:18 +0000 |
| commit | 39e50838bd12057d9305575f50c63990984df01a (patch) | |
| tree | 6ff2b45ed79aff00582c62942c2a283d92329b4f /lib/CodeGen/ConstantGen.cc | |
| parent | e1f41ed9fafaf7eb4f2da6878a3fabcf2f7c021e (diff) | |
feat(codegen): GLOBAL variables as LLVM globals
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/ConstantGen.cc')
| -rw-r--r-- | lib/CodeGen/ConstantGen.cc | 4 |
1 files changed, 2 insertions, 2 deletions
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); } |
