aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/Designator.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-16 10:09:47 +0000
committer_ov4 <ov4@ov4.org>2026-10-16 10:09:47 +0000
commite2c65706e61be09ddb7eeb28cd1957acd4317bcf (patch)
tree15447a03d67d395a722c5be3f0b05bc9f197197a /lib/CodeGen/Designator.cc
parent45c9d37eb27d204a6202b33cb37e890af0171357 (diff)
feat(constants): implement literal constants with lexical scope
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/Designator.cc')
-rw-r--r--lib/CodeGen/Designator.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/CodeGen/Designator.cc b/lib/CodeGen/Designator.cc
index 6c00524..afaf0a4 100644
--- a/lib/CodeGen/Designator.cc
+++ b/lib/CodeGen/Designator.cc
@@ -54,6 +54,7 @@ bool CodeGen::emitLValue(ExprAST *E, LValueInfo &Out) {
}
return false;
}
+ if (!requireWritable(*Info, Var->getName())) return false;
if (Info->IsArray) {
reportError("Whole array %s is not an assignable location; index it", Var->getName().c_str());
return false;
@@ -84,6 +85,7 @@ bool CodeGen::emitLValue(ExprAST *E, LValueInfo &Out) {
return false;
}
+ if (!requireWritable(*Info, D->getBaseName())) return false;
const auto &Accesses = D->getAccesses();
Value *Addr = Info->Storage;
std::string TypeName = Info->TypeName;