Skip to content

Commit c80415a

Browse files
committed
filter groupshared var decls
1 parent 63c465b commit c80415a

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
@@ -484,7 +484,8 @@ void createHostLayoutStructForBuffer(Sema &S, HLSLBufferDecl *BufDecl) {
484484

485485
for (Decl *D : BufDecl->decls()) {
486486
VarDecl *VD = dyn_cast<VarDecl>(D);
487-
if (!VD || VD->getStorageClass() == SC_Static)
487+
if (!VD || VD->getStorageClass() == SC_Static ||
488+
VD->getType().getAddressSpace() == LangAS::hlsl_groupshared)
488489
continue;
489490
const Type *Ty = VD->getType()->getUnqualifiedDesugaredType();
490491
if (FieldDecl *FD =

clang/test/AST/HLSL/cbuffer.hlsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ cbuffer CB {
7171
float d2[0];
7272
// CHECK: VarDecl {{.*}} f2 'RWBuffer<float>[2]'
7373
RWBuffer<float> f2[2];
74+
// CHECK: VarDecl {{.*}} g2 'groupshared float'
75+
groupshared float g2;
7476
// CHECK: VarDecl {{.*}} e2 'hlsl_constant float'
7577
float e2;
7678
// CHECK: CXXRecordDecl {{.*}} implicit referenced struct __cblayout_CB_1 definition

0 commit comments

Comments
 (0)