[clang] [HLSL] Collect explicit resource binding information (part 1) (PR #111203)

Joshua Batista via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 14:53:53 PDT 2024


================
@@ -1135,21 +1147,19 @@ static void ValidateMultipleRegisterAnnotations(Sema &S, Decl *TheDecl,
 
       RegisterType otherRegType = getRegisterType(attr->getSlot());
       if (RegisterTypesDetected[static_cast<int>(otherRegType)]) {
-        if (PreviousConflicts[TheDecl].count(otherRegType))
----------------
bob80905 wrote:

PreviousConflicts is no longer in use as a variable. You could remove it. But it seems unnecessary that you also handle duplicate RBAs in a separate part of the code. Wouldn't it be possible to check here if the decl is a UDT, and load in the relevant data into RBA (the resource field decl) if it is a UDT? 
If not, it might be useful to add a comment above the function stating: "This function validates multiple RBAs for non-udt resource decls, UDT resource decls are validated for duplicate RBAs in `ContainsResourceForRegisterType`"


https://github.com/llvm/llvm-project/pull/111203


More information about the cfe-commits mailing list