================ @@ -674,6 +700,34 @@ BuiltinTypeDeclBuilder::addHandleAccessFunction(DeclarationName &Name, .finalizeMethod(); } +BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addAppendMethod() { + using PH = BuiltinTypeMethodBuilder::PlaceHolder; + ASTContext &AST = SemaRef.getASTContext(); + QualType ElemTy = getHandleElementType(); + return BuiltinTypeMethodBuilder(*this, "Append", AST.VoidTy) + .addParam("value", ElemTy) + .callBuiltin("__builtin_hlsl_buffer_update_counter", AST.UnsignedIntTy, + PH::Handle, getConstantIntExpr(1)) + .callBuiltin("__builtin_hlsl_resource_getpointer", + AST.getPointerType(ElemTy), PH::Handle, PH::LastStmtPop) + .dereference() + .assign(PH::_0) ---------------- bogner wrote:
Should we make all of the methods that operate on the last statement use this explicitly? Something like: ```suggestion .callBuiltin("__builtin_hlsl_resource_getpointer", AST.getPointerType(ElemTy), PH::Handle, PH::LastStmtPop) .dereference(PH::LastStmtPop) .assign(PH::LastStmtPop, PH::_0) ``` I'm not sure if this is better or worse though. I also think in that case we could maybe just shorten this to `LastStmt` since we'd be using it a lot. https://github.com/llvm/llvm-project/pull/118536 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits