@@ -3048,21 +3048,21 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
30483048 }
30493049 case Builtin::BI__builtin_hlsl_resource_uninitializedhandle: {
30503050 assert (TheCall->getNumArgs () == 1 && " expected 1 arg" );
3051- // use the type of the handle (arg0) as a return type
3051+ // Update return type to be the attributed resource type from arg0.
30523052 QualType ResourceTy = TheCall->getArg (0 )->getType ();
30533053 TheCall->setType (ResourceTy);
30543054 break ;
30553055 }
30563056 case Builtin::BI__builtin_hlsl_resource_handlefrombinding: {
30573057 assert (TheCall->getNumArgs () == 6 && " expected 6 args" );
3058- // use the type of the handle (arg0) as a return type
3058+ // Update return type to be the attributed resource type from arg0.
30593059 QualType ResourceTy = TheCall->getArg (0 )->getType ();
30603060 TheCall->setType (ResourceTy);
30613061 break ;
30623062 }
30633063 case Builtin::BI__builtin_hlsl_resource_handlefromimplicitbinding: {
30643064 assert (TheCall->getNumArgs () == 6 && " expected 6 args" );
3065- // use the type of the handle (arg0) as a return type
3065+ // Update return type to be the attributed resource type from arg0.
30663066 QualType ResourceTy = TheCall->getArg (0 )->getType ();
30673067 TheCall->setType (ResourceTy);
30683068 break ;
@@ -3078,6 +3078,8 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
30783078 QualType CounterHandleTy = AST.getHLSLAttributedResourceType (
30793079 MainResType->getWrappedType (), MainResType->getContainedType (),
30803080 MainAttrs);
3081+ // Update return type to be the attributed resource type from arg0
3082+ // with added IsCounter flag.
30813083 TheCall->setType (CounterHandleTy);
30823084 break ;
30833085 }
0 commit comments