Skip to content

Commit 568bb70

Browse files
committed
Change GetDimensions to use __hlsl_resource_t in the builtin signature
1 parent 382fa71 commit 568bb70

File tree

5 files changed

+10
-28
lines changed

5 files changed

+10
-28
lines changed

clang/include/clang/Basic/Builtins.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4967,13 +4967,13 @@ def HLSLResourceNonUniformIndex : LangBuiltin<"HLSL_LANG"> {
49674967
def HLSLResourceGetDimensionsX : LangBuiltin<"HLSL_LANG"> {
49684968
let Spellings = ["__builtin_hlsl_resource_getdimensions_x"];
49694969
let Attributes = [NoThrow];
4970-
let Prototype = "void(...)";
4970+
let Prototype = "void(__hlsl_resource_t, uint32_t&)";
49714971
}
49724972

49734973
def HLSLResourceGetStride : LangBuiltin<"HLSL_LANG"> {
49744974
let Spellings = ["__builtin_hlsl_resource_getstride"];
49754975
let Attributes = [NoThrow];
4976-
let Prototype = "void(...)";
4976+
let Prototype = "void(__hlsl_resource_t, uint32_t&)";
49774977
}
49784978

49794979
def HLSLAll : LangBuiltin<"HLSL_LANG"> {

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,24 +3045,6 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
30453045
TheCall->setType(CounterHandleTy);
30463046
break;
30473047
}
3048-
case Builtin::BI__builtin_hlsl_resource_getdimensions_x: {
3049-
ASTContext &AST = SemaRef.getASTContext();
3050-
if (SemaRef.checkArgCount(TheCall, 2) ||
3051-
CheckResourceHandle(&SemaRef, TheCall, 0) ||
3052-
CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) ||
3053-
CheckModifiableLValue(&SemaRef, TheCall, 1))
3054-
return true;
3055-
break;
3056-
}
3057-
case Builtin::BI__builtin_hlsl_resource_getstride: {
3058-
ASTContext &AST = SemaRef.getASTContext();
3059-
if (SemaRef.checkArgCount(TheCall, 2) ||
3060-
CheckResourceHandle(&SemaRef, TheCall, 0) ||
3061-
CheckArgTypeMatches(&SemaRef, TheCall->getArg(1), AST.UnsignedIntTy) ||
3062-
CheckModifiableLValue(&SemaRef, TheCall, 1))
3063-
return true;
3064-
break;
3065-
}
30663048
case Builtin::BI__builtin_hlsl_and:
30673049
case Builtin::BI__builtin_hlsl_or: {
30683050
if (SemaRef.checkArgCount(TheCall, 2))

clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ RESOURCE Buffer;
149149
// CHECK-NEXT: HLSLParamModifierAttr {{.*}} out
150150
// CHECK-NEXT: CompoundStmt
151151
// CHECK-NEXT: CallExpr {{.*}} 'void'
152-
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr>
153-
// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_getdimensions_x' 'void (...) noexcept'
152+
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(__hlsl_resource_t, unsigned int &) noexcept' <BuiltinFnToFnPtr>
153+
// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_getdimensions_x' 'void (__hlsl_resource_t, unsigned int &) noexcept'
154154
// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle {{.*}}
155155
// CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]' lvalue implicit this
156156
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'dim' 'unsigned int &__restrict'

clang/test/AST/HLSL/StructuredBuffers-AST.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,14 +417,14 @@ RESOURCE<float> Buffer;
417417
// CHECK-NEXT: HLSLParamModifierAttr {{.*}} out
418418
// CHECK-NEXT: CompoundStmt
419419
// CHECK-NEXT: CallExpr {{.*}} 'void'
420-
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr>
421-
// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_getdimensions_x' 'void (...) noexcept'
420+
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(__hlsl_resource_t, unsigned int &) noexcept' <BuiltinFnToFnPtr>
421+
// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_getdimensions_x' 'void (__hlsl_resource_t, unsigned int &) noexcept'
422422
// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle {{.*}}
423423
// CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue implicit this
424424
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'numStructs' 'unsigned int &__restrict'
425425
// CHECK-NEXT: CallExpr {{.*}} 'void'
426-
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr>
427-
// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_getstride' 'void (...) noexcept'
426+
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(__hlsl_resource_t, unsigned int &) noexcept' <BuiltinFnToFnPtr>
427+
// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_getstride' 'void (__hlsl_resource_t, unsigned int &) noexcept'
428428
// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle {{.*}}
429429
// CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue implicit this
430430
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'stride' 'unsigned int &__restrict'

clang/test/AST/HLSL/TypedBuffers-AST.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ RESOURCE<float> Buffer;
221221
// CHECK-NEXT: HLSLParamModifierAttr {{.*}} out
222222
// CHECK-NEXT: CompoundStmt
223223
// CHECK-NEXT: CallExpr {{.*}} 'void'
224-
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(...) noexcept' <BuiltinFnToFnPtr>
225-
// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_getdimensions_x' 'void (...) noexcept'
224+
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(__hlsl_resource_t, unsigned int &) noexcept' <BuiltinFnToFnPtr>
225+
// CHECK-NEXT: DeclRefExpr {{.*}} '<builtin fn type>' Function {{.*}} '__builtin_hlsl_resource_getdimensions_x' 'void (__hlsl_resource_t, unsigned int &) noexcept'
226226
// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t {{.*}}' lvalue .__handle {{.*}}
227227
// CHECK-NEXT: CXXThisExpr {{.*}} 'hlsl::[[RESOURCE]]<element_type>' lvalue implicit this
228228
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'dim' 'unsigned int &__restrict'

0 commit comments

Comments
 (0)