[clang] [HLSL] Add empty struct test cases to `__builtin_hlsl_is_typed_resource_element_compatible` test file (PR #115045)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 8 13:11:59 PST 2024
================
@@ -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-beanz wrote:
nit: https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
```suggestion
if (CanonicalType->getAs<clang::RecordType>())
return false;
```
https://github.com/llvm/llvm-project/pull/115045
More information about the cfe-commits
mailing list