llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Helena Kotas (hekota) <details> <summary>Changes</summary> This change adds resource handle type `__hlsl_resource_t` to the list of types recognized in the Clang's built-in functions prototype string. HLSL has built-in resource classes and some of them have many methods, such as [Texture2D](https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/sm5-object-texture2d). Most of these methods will be implemented by built-in functions that will take resource handle as an argument. This change enables us to move from generic `void(...)` prototype string for these methods and explicit argument checking in `SemaHLSL.cpp` to a prototype string with explicit argument types. Argument checking in `SemaHLSL.cpp` can be reduced to handle just the rules that cannot be expressed in the prototype string (for example verifying that the offset value in `__builtin_hlsl_buffer_update_counter` is `1` or `-1`). In order to make this work, we now allow conversions from attributed resource handle type such as `__hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::contained_type(float)]]` to a plain non-attributed `__hlsl_resource_t` type. --- Patch is 35.30 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/163465.diff 9 Files Affected: - (modified) clang/include/clang/Basic/Builtins.td (+8-8) - (modified) clang/lib/AST/ASTContext.cpp (+3) - (modified) clang/lib/Sema/SemaHLSL.cpp (+6-51) - (modified) clang/lib/Sema/SemaOverload.cpp (+28-14) - (modified) clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl (+8-8) - (modified) clang/test/AST/HLSL/StructuredBuffers-AST.hlsl (+26-26) - (modified) clang/test/AST/HLSL/TypedBuffers-AST.hlsl (+8-8) - (modified) clang/test/SemaHLSL/BuiltIns/buffer_update_counter-errors.hlsl (+2-2) - (modified) clang/utils/TableGen/ClangBuiltinsEmitter.cpp (+1) ``````````diff diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td index 2b400b012d6ed..e13c1d004797a 100644 --- a/clang/include/clang/Basic/Builtins.td +++ b/clang/include/clang/Basic/Builtins.td @@ -4937,25 +4937,25 @@ def HLSLResourceGetPointer : LangBuiltin<"HLSL_LANG"> { def HLSLResourceUninitializedHandle : LangBuiltin<"HLSL_LANG"> { let Spellings = ["__builtin_hlsl_resource_uninitializedhandle"]; let Attributes = [NoThrow]; - let Prototype = "void(...)"; + let Prototype = "__hlsl_resource_t(__hlsl_resource_t)"; } def HLSLResourceHandleFromBinding : LangBuiltin<"HLSL_LANG"> { let Spellings = ["__builtin_hlsl_resource_handlefrombinding"]; let Attributes = [NoThrow]; - let Prototype = "void(...)"; + let Prototype = "__hlsl_resource_t(__hlsl_resource_t, uint32_t, uint32_t, int32_t, uint32_t, char const*)"; } def HLSLResourceHandleFromImplicitBinding : LangBuiltin<"HLSL_LANG"> { let Spellings = ["__builtin_hlsl_resource_handlefromimplicitbinding"]; let Attributes = [NoThrow]; - let Prototype = "void(...)"; + let Prototype = "__hlsl_resource_t(__hlsl_resource_t, uint32_t, uint32_t, int32_t, uint32_t, char const*)"; } def HLSLResourceCounterHandleFromImplicitBinding : LangBuiltin<"HLSL_LANG"> { let Spellings = ["__builtin_hlsl_resource_counterhandlefromimplicitbinding"]; - let Attributes = [NoThrow, CustomTypeChecking]; - let Prototype = "void(...)"; + let Attributes = [NoThrow]; + let Prototype = "__hlsl_resource_t(__hlsl_resource_t, uint32_t, uint32_t)"; } def HLSLResourceNonUniformIndex : LangBuiltin<"HLSL_LANG"> { @@ -4967,13 +4967,13 @@ def HLSLResourceNonUniformIndex : LangBuiltin<"HLSL_LANG"> { def HLSLResourceGetDimensionsX : LangBuiltin<"HLSL_LANG"> { let Spellings = ["__builtin_hlsl_resource_getdimensions_x"]; let Attributes = [NoThrow]; - let Prototype = "void(...)"; + let Prototype = "void(__hlsl_resource_t, uint32_t&)"; } def HLSLResourceGetStride : LangBuiltin<"HLSL_LANG"> { let Spellings = ["__builtin_hlsl_resource_getstride"]; let Attributes = [NoThrow]; - let Prototype = "void(...)"; + let Prototype = "void(__hlsl_resource_t, uint32_t&)"; } def HLSLAll : LangBuiltin<"HLSL_LANG"> { @@ -5201,7 +5201,7 @@ def HLSLRadians : LangBuiltin<"HLSL_LANG"> { def HLSLBufferUpdateCounter : LangBuiltin<"HLSL_LANG"> { let Spellings = ["__builtin_hlsl_buffer_update_counter"]; let Attributes = [NoThrow]; - let Prototype = "uint32_t(...)"; + let Prototype = "uint32_t(__hlsl_resource_t, int)"; } def HLSLSplitDouble: LangBuiltin<"HLSL_LANG"> { diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 2669f62456711..920bb17e29e94 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -12615,6 +12615,9 @@ static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, case 'm': Type = Context.MFloat8Ty; break; + case 'r': + Type = Context.HLSLResourceTy; + break; } // If there are modifiers and if we're allowed to parse them, go for it. diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp index 94a490a8f68dc..5fb6b398db4d2 100644 --- a/clang/lib/Sema/SemaHLSL.cpp +++ b/clang/lib/Sema/SemaHLSL.cpp @@ -3011,54 +3011,29 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } case Builtin::BI__builtin_hlsl_resource_uninitializedhandle: { - if (SemaRef.checkArgCount(TheCall, 1) || - CheckResourceHandle(&SemaRef, TheCall, 0)) - return true; + assert(TheCall->getNumArgs() == 1 && "expected 1 arg"); // use the type of the handle (arg0) as a return type QualType ResourceTy = TheCall->getArg(0)->getType(); TheCall->setType(ResourceTy); break; } case Builtin::BI__builtin_hlsl_resource_handlefrombinding: { - ASTContext &AST = SemaRef.getASTContext(); - if (SemaRef.checkArgCount(TheCall, 6) || - CheckResourceHandle(&SemaRef, TheCall, 0) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(2), AST.UnsignedIntTy) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(3), AST.IntTy) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(4), AST.UnsignedIntTy) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(5), - AST.getPointerType(AST.CharTy.withConst()))) - return true; + assert(TheCall->getNumArgs() == 6 && "expected 6 args"); // use the type of the handle (arg0) as a return type QualType ResourceTy = TheCall->getArg(0)->getType(); TheCall->setType(ResourceTy); break; } case Builtin::BI__builtin_hlsl_resource_handlefromimplicitbinding: { - ASTContext &AST = SemaRef.getASTContext(); - if (SemaRef.checkArgCount(TheCall, 6) || - CheckResourceHandle(&SemaRef, TheCall, 0) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(2), AST.UnsignedIntTy) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(3), AST.IntTy) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(4), AST.UnsignedIntTy) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(5), - AST.getPointerType(AST.CharTy.withConst()))) - return true; + assert(TheCall->getNumArgs() == 6 && "expected 6 args"); // use the type of the handle (arg0) as a return type QualType ResourceTy = TheCall->getArg(0)->getType(); TheCall->setType(ResourceTy); break; } case Builtin::BI__builtin_hlsl_resource_counterhandlefromimplicitbinding: { + assert(TheCall->getNumArgs() == 3 && "expected 3 args"); ASTContext &AST = SemaRef.getASTContext(); - if (SemaRef.checkArgCount(TheCall, 3) || - CheckResourceHandle(&SemaRef, TheCall, 0) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(2), AST.UnsignedIntTy)) - return true; - QualType MainHandleTy = TheCall->getArg(0)->getType(); auto *MainResType = MainHandleTy->getAs<HLSLAttributedResourceType>(); auto MainAttrs = MainResType->getAttrs(); @@ -3070,24 +3045,6 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { TheCall->setType(CounterHandleTy); break; } - case Builtin::BI__builtin_hlsl_resource_getdimensions_x: { - ASTContext &AST = SemaRef.getASTContext(); - if (SemaRef.checkArgCount(TheCall, 2) || - CheckResourceHandle(&SemaRef, TheCall, 0) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) || - CheckModifiableLValue(&SemaRef, TheCall, 1)) - return true; - break; - } - case Builtin::BI__builtin_hlsl_resource_getstride: { - ASTContext &AST = SemaRef.getASTContext(); - if (SemaRef.checkArgCount(TheCall, 2) || - CheckResourceHandle(&SemaRef, TheCall, 0) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) || - CheckModifiableLValue(&SemaRef, TheCall, 1)) - return true; - break; - } case Builtin::BI__builtin_hlsl_and: case Builtin::BI__builtin_hlsl_or: { if (SemaRef.checkArgCount(TheCall, 2)) @@ -3385,14 +3342,12 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { break; } case Builtin::BI__builtin_hlsl_buffer_update_counter: { + assert(TheCall->getNumArgs() == 2 && "expected 2 args"); auto checkResTy = [](const HLSLAttributedResourceType *ResTy) -> bool { return !(ResTy->getAttrs().ResourceClass == ResourceClass::UAV && ResTy->getAttrs().RawBuffer && ResTy->hasContainedType()); }; - if (SemaRef.checkArgCount(TheCall, 2) || - CheckResourceHandle(&SemaRef, TheCall, 0, checkResTy) || - CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), - SemaRef.getASTContext().IntTy)) + if (CheckResourceHandle(&SemaRef, TheCall, 0, checkResTy)) return true; Expr *OffsetExpr = TheCall->getArg(1); std::optional<llvm::APSInt> Offset = diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 37f351174e3d0..c12f92dfdab66 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1825,20 +1825,34 @@ TryImplicitConversion(Sema &S, Expr *From, QualType ToType, return ICS; } - if (S.getLangOpts().HLSL && ToType->isHLSLAttributedResourceType() && - FromType->isHLSLAttributedResourceType()) { - auto *ToResType = cast<HLSLAttributedResourceType>(ToType); - auto *FromResType = cast<HLSLAttributedResourceType>(FromType); - if (S.Context.hasSameUnqualifiedType(ToResType->getWrappedType(), - FromResType->getWrappedType()) && - S.Context.hasSameUnqualifiedType(ToResType->getContainedType(), - FromResType->getContainedType()) && - ToResType->getAttrs() == FromResType->getAttrs()) { - ICS.setStandard(); - ICS.Standard.setAsIdentityConversion(); - ICS.Standard.setFromType(FromType); - ICS.Standard.setAllToTypes(ToType); - return ICS; + if (S.getLangOpts().HLSL) { + // Handle conversion of the HLSL resource types. + const Type *FromTy = FromType->getUnqualifiedDesugaredType(); + if (FromTy->isHLSLAttributedResourceType()) { + // Attributed resource types can convert to other attributed + // resource types with the same attributes and contained types, + // or to __hlsl_resource_t without any attributes. + bool CanConvert = false; + const Type *ToTy = ToType->getUnqualifiedDesugaredType(); + if (ToTy->isHLSLAttributedResourceType()) { + auto *ToResType = cast<HLSLAttributedResourceType>(ToTy); + auto *FromResType = cast<HLSLAttributedResourceType>(FromTy); + if (S.Context.hasSameUnqualifiedType(ToResType->getWrappedType(), + FromResType->getWrappedType()) && + S.Context.hasSameUnqualifiedType(ToResType->getContainedType(), + FromResType->getContainedType()) && + ToResType->getAttrs() == FromResType->getAttrs()) + CanConvert = true; + } else if (ToTy->isHLSLResourceType()) { + CanConvert = true; + } + if (CanConvert) { + ICS.setStandard(); + ICS.Standard.setAsIdentityConversion(); + ICS.Standard.setFromType(FromType); + ICS.Standard.setAllToTypes(ToType); + return ICS; + } } } diff --git a/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl b/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl index 61d5e5ab44c97..2713cc19ea2be 100644 --- a/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl +++ b/clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl @@ -50,8 +50,8 @@ RESOURCE Buffer; // CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle // CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]' lvalue implicit this // CHECK-NEXT: CallExpr {{.*}} '__hlsl_resource_t -// CHECK-NEXT: ImplicitCastExpr {{.*}} <BuiltinFnToFnPtr> -// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_uninitializedhandle' +// CHECK-NEXT: ImplicitCastExpr {{.*}} '__hlsl_resource_t (*)(__hlsl_resource_t) noexcept' <BuiltinFnToFnPtr> +// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_uninitializedhandle' '__hlsl_resource_t (__hlsl_resource_t) noexcept' // CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle // CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]' lvalue implicit this // CHECK-NEXT: AlwaysInlineAttr @@ -97,8 +97,8 @@ RESOURCE Buffer; // CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle // CHECK-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]' // CHECK-NEXT: CallExpr {{.*}} '__hlsl_resource_t {{.*}}' -// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr> -// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_handlefrombinding' 'void (...) noexcept' +// CHECK-NEXT: ImplicitCastExpr {{.*}} '__hlsl_resource_t (*)(__hlsl_resource_t, unsigned int, unsigned int, int, unsigned int, const char *) noexcept' <BuiltinFnToFnPtr> +// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_handlefrombinding' '__hlsl_resource_t (__hlsl_resource_t, unsigned int, unsigned int, int, unsigned int, const char *) noexcept' // CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle // CHECK-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]' // CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'registerNo' 'unsigned int' @@ -127,8 +127,8 @@ RESOURCE Buffer; // CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle // CHECK-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]' // CHECK-NEXT: CallExpr {{.*}} '__hlsl_resource_t {{.*}}' -// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr> -// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_handlefromimplicitbinding' 'void (...) noexcept' +// CHECK-NEXT: ImplicitCastExpr {{.*}} '__hlsl_resource_t (*)(__hlsl_resource_t, unsigned int, unsigned int, int, unsigned int, const char *) noexcept' <BuiltinFnToFnPtr> +// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_handlefromimplicitbinding' '__hlsl_resource_t (__hlsl_resource_t, unsigned int, unsigned int, int, unsigned int, const char *) noexcept' // CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle // CHECK-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]' // CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'orderId' 'unsigned int' @@ -149,8 +149,8 @@ RESOURCE Buffer; // CHECK-NEXT: HLSLParamModifierAttr {{.*}} out // CHECK-NEXT: CompoundStmt // CHECK-NEXT: CallExpr {{.*}} 'void' -// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr> -// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_getdimensions_x' 'void (...) noexcept' +// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(__hlsl_resource_t, unsigned int &) noexcept' <BuiltinFnToFnPtr> +// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_getdimensions_x' 'void (__hlsl_resource_t, unsigned int &) noexcept' // CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle {{.*}} // CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]' lvalue implicit this // CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'dim' 'unsigned int &__restrict' diff --git a/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl b/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl index 7a8c57c59643d..538eb5256f8d5 100644 --- a/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl +++ b/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl @@ -97,8 +97,8 @@ RESOURCE<float> Buffer; // CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle // CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue implicit this // CHECK-NEXT: CallExpr {{.*}} '__hlsl_resource_t -// CHECK-NEXT: ImplicitCastExpr {{.*}} <BuiltinFnToFnPtr> -// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_uninitializedhandle' +// CHECK-NEXT: ImplicitCastExpr {{.*}} '__hlsl_resource_t (*)(__hlsl_resource_t) noexcept' <BuiltinFnToFnPtr> +// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_uninitializedhandle' '__hlsl_resource_t (__hlsl_resource_t) noexcept' // CHECK-NEXT: MemberExpr {{.*}} lvalue .__handle // CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue implicit this // CHECK-NEXT: AlwaysInlineAttr @@ -154,8 +154,8 @@ RESOURCE<float> Buffer; // CHECK-BINDING-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle // CHECK-BINDING-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]<element_type>' // CHECK-BINDING-NEXT: CallExpr {{.*}} '__hlsl_resource_t {{.*}}' -// CHECK-BINDING-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr> -// CHECK-BINDING-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_handlefrombinding' 'void (...) noexcept' +// CHECK-BINDING-NEXT: ImplicitCastExpr {{.*}} '__hlsl_resource_t (*)(__hlsl_resource_t, unsigned int, unsigned int, int, unsigned int, const char *) noexcept' <BuiltinFnToFnPtr> +// CHECK-BINDING-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_handlefrombinding' '__hlsl_resource_t (__hlsl_resource_t, unsigned int, unsigned int, int, unsigned int, const char *) noexcept' // CHECK-BINDING-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle // CHECK-BINDING-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]<element_type>' // CHECK-BINDING-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'registerNo' 'unsigned int' @@ -182,8 +182,8 @@ RESOURCE<float> Buffer; // CHECK-BINDING-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle // CHECK-BINDING-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]<element_type>' // CHECK-BINDING-NEXT: CallExpr {{.*}} '__hlsl_resource_t {{.*}}' -// CHECK-BINDING-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr> -// CHECK-BINDING-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_handlefromimplicitbinding' 'void (...) noexcept' +// CHECK-BINDING-NEXT: ImplicitCastExpr {{.*}} '__hlsl_resource_t (*)(__hlsl_resource_t, unsigned int, unsigned int, int, unsigned int, const char *) noexcept' <BuiltinFnToFnPtr> +// CHECK-BINDING-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_handlefromimplicitbinding' '__hlsl_resource_t (__hlsl_resource_t, unsigned int, unsigned int, int, unsigned int, const char *) noexcept' // CHECK-BINDING-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle // CHECK-BINDING-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]<element_type>' // CHECK-BINDING-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'orderId' 'unsigned int' @@ -209,8 +209,8 @@ RESOURCE<float> Buffer; // CHECK-COUNTER-HANDLE-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle // CHECK-COUNTER-HANDLE-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]<element_type>' // CHECK-COUNTER-HANDLE-NEXT: CallExpr {{.*}} '__hlsl_resource_t {{.*}}' -// CHECK-COUNTER-HANDLE-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr> -// CHECK-COUNTER-HANDLE-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_handlefrombinding' 'void (...) noexcept' +// CHECK-COUNTER-HANDLE-NEXT: ImplicitCastExpr {{.*}} '__hlsl_resource_t (*)(__hlsl_resource_t, unsigned int, unsigned int, int, unsigned int, const char *) noexcept' <BuiltinFnToFnPtr> +// CHECK-COUNTER-HANDLE-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_handlefrombinding' '__hlsl_resource_t (__hlsl_resource_t, unsigned int, unsigned int, int, unsigned int, const char *) noexcept' // CHECK-COUNTER-HANDLE-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle // CHECK-COUNTER-HANDLE-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]<element_type>' // CHECK-COUNTER-HANDLE-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'registerNo' 'unsigned int' @@ -222,8 +222,8 @@ RESOURCE<float> Buffer; // CHECK-COUNTER-HANDLE-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__counter_handle // CHECK-COUNTER-HANDLE-NEXT: DeclRefExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue Var {{.*}} 'tmp' 'hlsl::[[RESOURCE]]<element_type>' /... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/163465 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
