Skip to content

Commit 3bc3b1c

Browse files
authored
[HLSL][NFC] Rename isImplicit() to hasRegisterStot() on HLSLResourceBindingAttr (#138964)
Renaming because the name `isImplicit` is ambiguous. It can mean implicit attribute or implicit binding.
1 parent a2b28a6 commit 3bc3b1c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4785,15 +4785,15 @@ def HLSLResourceBinding: InheritableAttr {
47854785
SlotNumber = SlotNum;
47864786
SpaceNumber = SpaceNum;
47874787
}
4788-
bool isImplicit() const {
4789-
return !SlotNumber.has_value();
4788+
bool hasRegisterSlot() const {
4789+
return SlotNumber.has_value();
47904790
}
47914791
RegisterType getRegisterType() const {
4792-
assert(!isImplicit() && "binding does not have register slot");
4792+
assert(hasRegisterSlot() && "binding does not have register slot");
47934793
return RegType;
47944794
}
47954795
unsigned getSlotNumber() const {
4796-
assert(!isImplicit() && "binding does not have register slot");
4796+
assert(hasRegisterSlot() && "binding does not have register slot");
47974797
return SlotNumber.value();
47984798
}
47994799
unsigned getSpaceNumber() const {

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ void CGHLSLRuntime::addBuffer(const HLSLBufferDecl *BufDecl) {
261261
BufDecl->getAttr<HLSLResourceBindingAttr>();
262262
// FIXME: handle implicit binding if no binding attribute is found
263263
// (llvm/llvm-project#110722)
264-
if (RBA && !RBA->isImplicit())
264+
if (RBA && RBA->hasRegisterSlot())
265265
initializeBufferFromBinding(CGM, BufGV, RBA->getSlotNumber(),
266266
RBA->getSpaceNumber());
267267
}

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@ void SemaHLSL::ActOnEndOfTranslationUnit(TranslationUnitDecl *TU) {
19791979
for (const Decl *VD : DefaultCBufferDecls) {
19801980
const HLSLResourceBindingAttr *RBA =
19811981
VD->getAttr<HLSLResourceBindingAttr>();
1982-
if (RBA && !RBA->isImplicit() &&
1982+
if (RBA && RBA->hasRegisterSlot() &&
19831983
RBA->getRegisterType() == HLSLResourceBindingAttr::RegisterType::C) {
19841984
DefaultCBuffer->setHasValidPackoffset(true);
19851985
break;
@@ -3271,7 +3271,7 @@ static bool initVarDeclWithCtor(Sema &S, VarDecl *VD,
32713271

32723272
static bool initGlobalResourceDecl(Sema &S, VarDecl *VD) {
32733273
HLSLResourceBindingAttr *RBA = VD->getAttr<HLSLResourceBindingAttr>();
3274-
if (!RBA || RBA->isImplicit())
3274+
if (!RBA || !RBA->hasRegisterSlot())
32753275
// FIXME: add support for implicit binding (llvm/llvm-project#110722)
32763276
return false;
32773277

@@ -3356,7 +3356,7 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) {
33563356
bool HasBinding = false;
33573357
for (Attr *A : VD->attrs()) {
33583358
HLSLResourceBindingAttr *RBA = dyn_cast<HLSLResourceBindingAttr>(A);
3359-
if (!RBA || RBA->isImplicit())
3359+
if (!RBA || !RBA->hasRegisterSlot())
33603360
continue;
33613361
HasBinding = true;
33623362

0 commit comments

Comments
 (0)