Skip to content
Merged
Changes from all commits
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
13 changes: 3 additions & 10 deletions clang/lib/Sema/SemaHLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,17 +834,10 @@ static void ValidateMultipleRegisterAnnotations(Sema &S, Decl *TheDecl,
static void DiagnoseHLSLRegisterAttribute(Sema &S, SourceLocation &ArgLoc,
Decl *TheDecl, RegisterType regType) {

// Samplers, UAVs, and SRVs are VarDecl types
VarDecl *TheVarDecl = dyn_cast<VarDecl>(TheDecl);
// Cbuffers and Tbuffers are HLSLBufferDecl types
HLSLBufferDecl *CBufferOrTBuffer = dyn_cast<HLSLBufferDecl>(TheDecl);

// exactly one of these two types should be set
assert(((TheVarDecl && !CBufferOrTBuffer) ||
(!TheVarDecl && CBufferOrTBuffer)) &&
"either TheVarDecl or CBufferOrTBuffer should be set");
(void)TheVarDecl;
(void)CBufferOrTBuffer;
assert(((isa<VarDecl>(TheDecl) && !isa<HLSLBufferDecl>(TheDecl)) ||
(!isa<VarDecl>(TheDecl) && isa<HLSLBufferDecl>(TheDecl))) &&
"expecting VarDecl or HLSLBufferDecl");

RegisterBindingFlags Flags = HLSLFillRegisterBindingFlags(S, TheDecl);
assert((int)Flags.Other + (int)Flags.Resource + (int)Flags.Basic +
Expand Down