================
@@ -2200,47 +2200,43 @@ static void BuildFlattenedTypeList(QualType BaseTy,
 }
 
 bool SemaHLSL::IsTypedResourceElementCompatible(clang::QualType QT) {
-  if (QT.isNull())
+  // null and array types are not allowed.
+  if (QT.isNull() || QT->isArrayType())
     return false;
 
-  // check if the outer type was an array type
-  if (QT->isArrayType())
+  // UDT types are not allowed
+  clang::QualType CanonicalType = QT.getCanonicalType();
+  if (CanonicalType->getAs<clang::RecordType>()) {
     return false;
+  }
 
-  llvm::SmallVector<QualType, 4> QTTypes;
-  BuildFlattenedTypeList(QT, QTTypes);
+  // the only other valid builtin types are scalars or vectors
+  if (const BuiltinType *BT = CanonicalType->getAs<BuiltinType>()) {
----------------
llvm-beanz wrote:

Vectors aren't `BuitinType`, so this can probably be simplified. Something like:

```cpp
  // All arithmetic and enumeration types are valid.
  if (QT->isArithmeticType() || QT->isEnumeralType())
    return true;
```

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

Reply via email to