[clang] [clang][CodeGen] Emit file-scope compound literals in a constant context (PR #221390)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 16 22:39:50 PDT 2026
================
@@ -5854,16 +5854,43 @@ bool Compiler<Emitter>::visitAPValue(const APValue &Val, PrimType ValType,
return this->emitNull(ValType, 0, nullptr, Info);
APValue::LValueBase Base = Val.getLValueBase();
- ArrayRef<APValue::LValuePathEntry> Path = Val.getLValuePath();
-
- if (const Expr *BaseExpr = Base.dyn_cast<const Expr *>())
- return this->visit(BaseExpr);
- if (const auto *VD = Base.dyn_cast<const ValueDecl *>()) {
+ QualType EntryType;
+ if (const Expr *BaseExpr = Base.dyn_cast<const Expr *>()) {
+ if (!this->visit(BaseExpr))
+ return false;
+ EntryType = BaseExpr->getType();
+ } else if (const auto *VD = Base.dyn_cast<const ValueDecl *>()) {
if (!this->visitDeclRef(VD, Info.asExpr()))
return false;
+ EntryType = VD->getType();
+ } else if (Base.is<TypeInfoLValue>()) {
+ EntryType = Base.getTypeInfoType();
+ if (!this->emitGetTypeid(Base.get<TypeInfoLValue>()
----------------
tbaederr wrote:
Shouldn't the first parameter be `EntryType.getTypePtr()` and the second `getTypeInfoType()`?
https://github.com/llvm/llvm-project/pull/221390
More information about the cfe-commits
mailing list