================
@@ -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)
----------------
hekota wrote:

ASTContext owns all allocations of AST nodes and will take care of free-ing the 
memory.

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

Reply via email to