================
@@ -635,46 +626,52 @@ RegisterBindingFlags HLSLFillRegisterBindingFlags(Sema 
&S, Decl *D) {
       } else
         r.Other = true;
     }
-  } else {
-    llvm_unreachable("unknown decl type");
   }
   return r;
 }
 
+int getRegisterTypeIndex(StringRef Slot) {
+  switch (Slot[0]) {
+  case 't':
+    return 0;
+  case 'u':
+    return 1;
+  case 'b':
+    return 2;
+  case 's':
+    return 3;
+  case 'c':
+    return 4;
+  case 'i':
+    return 5;
+  default:
+    llvm_unreachable("invalid register type");
+  }
+}
+
 static void ValidateMultipleRegisterAnnotations(Sema &S, Decl *D,
                                                 StringRef &Slot) {
-  // make sure that there are no register annotations applied to the decl
-  // with the same register type but different numbers
-  std::unordered_map<char, std::set<char>>
-      s; // store unique register type + numbers
-  std::set<char> starting_set = {Slot[1]};
-  s.insert(std::make_pair(Slot[0], starting_set));
+  // make sure that there are no tworegister annotations
+  // applied to the decl with the same register type
+  bool registerTypesDetectedCount[6];
+  for (int i = 0; i < 6; i++)
+    registerTypesDetectedCount[i] = false;
----------------
damyanp wrote:

```suggestion
  bool RegisterTypesDetected[6] = {false};
```

Can initialize in one line.  Also I think the "Count" part of the name might be 
from an earlier design.

Also, should start with a capital letter.

https://github.com/llvm/llvm-project/pull/97103
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to