================ @@ -431,15 +464,31 @@ Expr *BuiltinTypeMethodBuilder::getResourceHandleExpr() { OK_Ordinary); } +BuiltinTypeMethodBuilder & +BuiltinTypeMethodBuilder::createLocalVar(StringRef Name, QualType Ty) { + ensureCompleteDecl(); + + ASTContext &AST = DeclBuilder.SemaRef.getASTContext(); + VarDecl *VD = + VarDecl::Create(AST, Method, SourceLocation(), SourceLocation(), + &AST.Idents.get(Name, tok::TokenKind::identifier), Ty, + AST.getTrivialTypeSourceInfo(Ty), SC_None); + LocalVars.push_back(VD); + DeclStmt *DS = new (AST) + clang::DeclStmt(DeclGroupRef(VD), SourceLocation(), SourceLocation()); + StmtsList.push_back(DS); + return *this; +} + template <typename... Ts> BuiltinTypeMethodBuilder & BuiltinTypeMethodBuilder::callBuiltin(StringRef BuiltinName, QualType ReturnType, Ts... ArgSpecs) { + ensureCompleteDecl(); ---------------- hekota wrote:
This move was intentional. We need a complete method declaration (=all parameters created) before `convertPlaceHolder` can refer to them. https://github.com/llvm/llvm-project/pull/155866 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits