[clang] [HLSL] Add static methods for resource initialization (PR #155866)
Helena Kotas via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 8 10:54:19 PDT 2025
================
@@ -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
More information about the cfe-commits
mailing list