Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/Parse/ParseHLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static bool validateDeclsInsideHLSLBuffer(Parser::DeclGroupPtrTy DG,
// Only allow function, variable, record decls inside HLSLBuffer.
for (DeclGroupRef::iterator I = Decls.begin(), E = Decls.end(); I != E; ++I) {
Decl *D = *I;
if (isa<CXXRecordDecl, RecordDecl, FunctionDecl, VarDecl>(D))
if (isa<CXXRecordDecl, RecordDecl, FunctionDecl, VarDecl, EmptyDecl>(D))
continue;

// FIXME: support nested HLSLBuffer and namespace inside HLSLBuffer.
Expand Down
12 changes: 12 additions & 0 deletions clang/test/SemaHLSL/cb_error.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,15 @@ tbuffer B {
// expected-error@+1 {{unknown type name 'flaot'}}
flaot f;
}

// None of these should produce an error!
cbuffer EmptyCBuffer {}

cbuffer EmptyDeclCBuffer {
;
}

cbuffer EmptyDecl2CBuffer {
;
int X;
}