[clang] Implement resource binding type prefix mismatch diagnostic infrastructure (PR #97103)

Damyan Pepper via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 16 10:35:17 PDT 2024


================
@@ -551,24 +541,21 @@ getHLSLResourceAttrFromEitherDecl(VarDecl *VD,
 
     // the resource attr could be on the record decl itself or on one of
     // its fields (the resource handle, most commonly)
-    const auto *Attr = TheRecordDecl->getAttr<HLSLResourceAttr>();
+    const auto *Attr = TheRecordDecl->getAttr<T>();
     if (!Attr) {
       for (auto *FD : TheRecordDecl->fields()) {
-        Attr = FD->getAttr<HLSLResourceAttr>();
+        Attr = FD->getAttr<T>();
         if (Attr)
           break;
       }
     }
     return Attr;
-  } else if (CBufferOrTBuffer) {
-    const auto *Attr = CBufferOrTBuffer->getAttr<HLSLResourceAttr>();
-    return Attr;
   }
-  llvm_unreachable("one of the two conditions should be true.");
+  llvm_unreachable("VD should not be null");
   return nullptr;
 }
 
-void traverseType(QualType TheQualTy, RegisterBindingFlags &Flags) {
+static void setFlagsFromType(QualType TheQualTy, RegisterBindingFlags &Flags) {
----------------
damyanp wrote:

nit: maybe should `updateFlagsFromType` since it modifies the Flags passed in to it, doesn't set them.

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


More information about the cfe-commits mailing list