File tree Expand file tree Collapse file tree 2 files changed +9
-16
lines changed
test/SemaHLSL/Types/Traits Expand file tree Collapse file tree 2 files changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -2205,33 +2205,26 @@ bool SemaHLSL::IsTypedResourceElementCompatible(clang::QualType QT) {
22052205 return false ;
22062206
22072207 // UDT types are not allowed
2208- clang::QualType CanonicalType = QT.getCanonicalType ();
2209- if (CanonicalType->getAs <clang::RecordType>()) {
2208+ if (QT->isRecordType ())
22102209 return false ;
2211- }
2212-
2213- // the only other valid builtin types are scalars or vectors
2214- if (const BuiltinType *BT = CanonicalType->getAs <BuiltinType>()) {
2215- if (BT->isBooleanType () || BT->isEnumeralType ())
2216- return false ;
22172210
2218- int TotalSizeInBytes = SemaRef.Context .getTypeSize (BT) / 8 ;
2211+ if (QT->isBooleanType () || QT->isEnumeralType ())
2212+ return false ;
22192213
2220- if (TotalSizeInBytes > 16 )
2214+ // the only other valid builtin types are scalars or vectors
2215+ if (QT->isArithmeticType ()) {
2216+ if (SemaRef.Context .getTypeSize (QT) / 8 > 16 )
22212217 return false ;
22222218 return true ;
22232219 }
22242220
2225- if (const VectorType *VT = CanonicalType ->getAs <VectorType>()) {
2221+ if (const VectorType *VT = QT ->getAs <VectorType>()) {
22262222 int ArraySize = VT->getNumElements ();
22272223
22282224 if (ArraySize > 4 )
22292225 return false ;
22302226
2231- QualType ElTy = VT->getElementType ();
2232- int TotalSizeInBytes = (SemaRef.Context .getTypeSize (ElTy) / 8 ) * ArraySize;
2233-
2234- if (TotalSizeInBytes > 16 )
2227+ if (SemaRef.Context .getTypeSize (QT) / 8 > 16 )
22352228 return false ;
22362229 return true ;
22372230 }
Original file line number Diff line number Diff line change 11// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s
22
33// types must be complete
4- _Static_assert (__builtin_hlsl_is_typed_resource_element_compatible (__hlsl_resource_t), "" );
4+ _Static_assert (! __builtin_hlsl_is_typed_resource_element_compatible (__hlsl_resource_t), "" );
55
66// expected-note@+1{{forward declaration of 'notComplete'}}
77struct notComplete;
You can’t perform that action at this time.
0 commit comments