================ @@ -238,31 +238,44 @@ void CIRGenFunction::emitCtorPrologue(const CXXConstructorDecl *cd, bool constructVBases = ctorType != Ctor_Base && classDecl->getNumVBases() != 0 && !classDecl->isAbstract(); - if (constructVBases) { - cgm.errorNYI(cd->getSourceRange(), "emitCtorPrologue: virtual base"); - return; - } - - const mlir::Value oldThisValue = cxxThisValue; - if (!constructVBases && b != e && (*b)->isBaseInitializer() && - (*b)->isBaseVirtual()) { + if (constructVBases && + !cgm.getTarget().getCXXABI().hasConstructorVariants()) { cgm.errorNYI(cd->getSourceRange(), - "emitCtorPrologue: virtual base initializer"); + "emitCtorPrologue: virtual base without variants"); return; } - // Handle non-virtual base initializers. - for (; b != e && (*b)->isBaseInitializer(); b++) { - assert(!(*b)->isBaseVirtual()); + const mlir::Value oldThisValue = cxxThisValue; + // Initialize virtual bases. + auto emitInitializer = [&](CXXCtorInitializer *baseInit) { if (cgm.getCodeGenOpts().StrictVTablePointers && cgm.getCodeGenOpts().OptimizationLevel > 0 && - isInitializerOfDynamicClass(*b)) { + isInitializerOfDynamicClass(baseInit)) { + // It's OK to continue after emitting the error here. The missing code + // just "launders" the 'this' pointer. cgm.errorNYI(cd->getSourceRange(), - "emitCtorPrologue: strict vtable pointers"); - return; + "emitCtorPrologue: strict vtable pointers for vbase"); } - emitBaseInitializer(getLoc(cd->getBeginLoc()), classDecl, *b); + emitBaseInitializer(getLoc(cd->getBeginLoc()), classDecl, baseInit); + }; + + for (; b != e && (*b)->isBaseInitializer() && (*b)->isBaseVirtual(); b++) { + if (!constructVBases) ---------------- erichkeane wrote:
Why is this inside the loop rather than preventing this loop from happening at all? Also, is there any sort of range loop we can use here? Thisis awful ugly... https://github.com/llvm/llvm-project/pull/155534 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits