Skip to content

Commit a8cdd45

Browse files
committed
Merge branch 'users/hekota/pr-124840' of https://github.com/llvm/llvm-project into cbuffer-codegen5
2 parents 66ae784 + e042f72 commit a8cdd45

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,15 @@ static bool isResourceRecordTypeOrArrayOf(const Type *Ty) {
285285
// array, or a builtin intangible type. Returns false it is a valid leaf element
286286
// type or if it is a record type that needs to be inspected further.
287287
static bool isInvalidConstantBufferLeafElementType(const Type *Ty) {
288+
Ty = Ty->getUnqualifiedDesugaredType();
288289
if (isResourceRecordTypeOrArrayOf(Ty))
289290
return true;
290291
if (Ty->isRecordType())
291292
return Ty->getAsCXXRecordDecl()->isEmpty();
292293
if (Ty->isConstantArrayType() &&
293294
isZeroSizedArray(cast<ConstantArrayType>(Ty)))
294295
return true;
295-
if (Ty->isHLSLBuiltinIntangibleType())
296+
if (Ty->isHLSLBuiltinIntangibleType() || Ty->isHLSLAttributedResourceType())
296297
return true;
297298
return false;
298299
}

clang/test/AST/HLSL/cbuffer.hlsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ cbuffer CB {
7575
groupshared float g2;
7676
// CHECK: VarDecl {{.*}} e2 'hlsl_constant float'
7777
float e2;
78+
// CHECK: VarDecl {{.*}} h2 '__hlsl_resource_t'
79+
__hlsl_resource_t h2;
7880
// CHECK: CXXRecordDecl {{.*}} implicit referenced struct __cblayout_CB_1 definition
7981
// CHECK: PackedAttr
8082
// CHECK-NEXT: FieldDecl {{.*}} a2 'float'

0 commit comments

Comments
 (0)