================
@@ -19804,3 +19803,36 @@ void
Sema::ActOnFinishFunctionDeclarationDeclarator(Declarator &Declarator) {
}
InventedParameterInfos.pop_back();
}
+
+bool Sema::BuildCtorClosureDefaultArgs(SourceLocation Loc,
+ CXXConstructorDecl *Ctor, bool IsCopy) {
+ assert(Context.getTargetInfo().getCXXABI().isMicrosoft());
+
+ if (!Ctor->getCtorClosureDefaultArgs().empty()) {
+ // If we build args for default constructor closures, those will have
+ // been generated *before* building args for any copy constructor closures.
+ assert(IsCopy || Ctor->getCtorClosureDefaultArgs()[0] != nullptr);
+ return false;
+ }
+
+ unsigned NumParams = Ctor->getNumParams();
+ if (NumParams == 0)
+ return false;
+
+ CXXDefaultArgExpr **Args =
+ new (getASTContext()) CXXDefaultArgExpr *[NumParams];
+
+ if (IsCopy)
+ Args[0] = nullptr; // Copy ctor closure will provide the first argument.
+
+ for (unsigned I = IsCopy ? 1 : 0; I != NumParams; ++I) {
+ ExprResult R = BuildCXXDefaultArgExpr(Loc, Ctor, Ctor->getParamDecl(I));
+ CleanupVarDeclMarking();
----------------
zmodem wrote:
(Archeology: this was originally `DiscardCleanupsInEvaluationContext()` in
9321f926b01bfba21fa2524d916b889f280bae8e, then changed to
`CleanupVarDeclMarking()` in 40ad6670138ab8130a426432b0e94544b5e03642).
Hmm, which kind of ExpressionEvaluationContext should be use here in that case?
https://github.com/llvm/llvm-project/pull/203554
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits