[clang] [CIR] Unblock simple C++ structure support (PR #138368)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Tue May 6 13:47:58 PDT 2025
================
@@ -365,10 +365,15 @@ mlir::Attribute ConstantEmitter::tryEmitPrivateForVarInit(const VarDecl &d) {
if (!d.hasLocalStorage()) {
QualType ty = cgm.getASTContext().getBaseElementType(d.getType());
if (ty->isRecordType())
- if (d.getInit() && isa<CXXConstructExpr>(d.getInit())) {
- cgm.errorNYI(d.getInit()->getBeginLoc(),
- "tryEmitPrivateForVarInit CXXConstructExpr");
- return {};
+ if (const CXXConstructExpr *e =
+ dyn_cast_or_null<CXXConstructExpr>(d.getInit())) {
+ const CXXConstructorDecl *cd = e->getConstructor();
----------------
andykaylor wrote:
@bcardosolopes Does that mean that we should be emitting an elidable constructor in CIR even if the `-fno-elide-constructors` option isn't used? The incubator is eliding them the same way classic codegen does.
For the case without `-std=c++14` I'm not sure we have much choice since it's not even in the AST.
https://github.com/llvm/llvm-project/pull/138368
More information about the cfe-commits
mailing list