[clang] [CIR] Refactor global variable emission and initialization (PR #138222)
Morris Hafner via cfe-commits
cfe-commits at lists.llvm.org
Fri May 2 12:16:21 PDT 2025
================
@@ -118,7 +210,26 @@ class ConstExprEmitter
}
mlir::Attribute VisitInitListExpr(InitListExpr *ile, QualType t) {
- cgm.errorNYI(ile->getBeginLoc(), "ConstExprEmitter::VisitInitListExpr");
+ if (ile->isTransparent())
+ return Visit(ile->getInit(0), t);
+
+ if (ile->getType()->isArrayType()) {
+ // If we return null here, the non-constant initializer will take care of
+ // it, but we would prefer to handle it here.
+ assert(!cir::MissingFeatures::constEmitterArrayILE());
+ return {};
+ }
+
+ if (ile->getType()->isRecordType())
+ cgm.errorNYI(ile->getBeginLoc(), "ConstExprEmitter: record ILE");
----------------
mmha wrote:
I'd add an explicit `return {};` here just from a defensive programming standpoint.
Should this also have its own `MissingFeature` assert?
https://github.com/llvm/llvm-project/pull/138222
More information about the cfe-commits
mailing list