Skip to content

Commit 2c68227

Browse files
authored
Revert "[HLSL] add IsTypedResourceElementCompatible type trait" (llvm#114853)
Reverts llvm#113730 Reverting because test compiler-rt default failed, with: error: comparison of different enumeration types ('Kind' and 'clang::Type::TypeClass')
1 parent 596fd10 commit 2c68227

File tree

6 files changed

+0
-168
lines changed

6 files changed

+0
-168
lines changed

clang/include/clang/Basic/TokenKinds.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,6 @@ KEYWORD(out , KEYHLSL)
662662
// HLSL Type traits
663663
TYPE_TRAIT_2(__builtin_hlsl_is_scalarized_layout_compatible, IsScalarizedLayoutCompatible, KEYHLSL)
664664
TYPE_TRAIT_1(__builtin_hlsl_is_intangible, IsIntangibleType, KEYHLSL)
665-
TYPE_TRAIT_1(__builtin_hlsl_is_typed_resource_element_compatible, IsTypedResourceElementCompatible, KEYHLSL)
666665

667666
// OpenMP Type Traits
668667
UNARY_EXPR_OR_TYPE_TRAIT(__builtin_omp_required_simd_align, OpenMPRequiredSimdAlign, KEYALL)

clang/include/clang/Sema/SemaHLSL.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ class SemaHLSL : public SemaBase {
132132

133133
// HLSL Type trait implementations
134134
bool IsScalarizedLayoutCompatible(QualType T1, QualType T2) const;
135-
bool IsTypedResourceElementCompatible(QualType T1);
136135

137136
bool CheckCompatibleParameterABI(FunctionDecl *New, FunctionDecl *Old);
138137

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5032,7 +5032,6 @@ static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S, TypeTrait UTT,
50325032
case UTT_IsScalar:
50335033
case UTT_IsCompound:
50345034
case UTT_IsMemberPointer:
5035-
case UTT_IsTypedResourceElementCompatible:
50365035
// Fall-through
50375036

50385037
// These traits are modeled on type predicates in C++0x [meta.unary.prop]
@@ -5715,15 +5714,6 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
57155714
tok::kw___builtin_hlsl_is_intangible))
57165715
return false;
57175716
return T->isHLSLIntangibleType();
5718-
5719-
case UTT_IsTypedResourceElementCompatible:
5720-
assert(Self.getLangOpts().HLSL &&
5721-
"line vector layout compatible types are HLSL-only feature");
5722-
if (Self.RequireCompleteType(TInfo->getTypeLoc().getBeginLoc(), T,
5723-
diag::err_incomplete_type))
5724-
return false;
5725-
5726-
return Self.HLSL().IsTypedResourceElementCompatible(T);
57275717
}
57285718
}
57295719

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,51 +2199,6 @@ static void BuildFlattenedTypeList(QualType BaseTy,
21992199
}
22002200
}
22012201

2202-
bool SemaHLSL::IsTypedResourceElementCompatible(clang::QualType QT) {
2203-
if (QT.isNull())
2204-
return false;
2205-
2206-
// check if the outer type was an array type
2207-
if (QT->isArrayType())
2208-
return false;
2209-
2210-
llvm::SmallVector<QualType, 4> QTTypes;
2211-
BuildFlattenedTypeList(QT, QTTypes);
2212-
2213-
assert(QTTypes.size() > 0 &&
2214-
"expected at least one constituent type from non-null type");
2215-
QualType FirstQT = QTTypes[0];
2216-
2217-
// element count cannot exceed 4
2218-
if (QTTypes.size() > 4)
2219-
return false;
2220-
2221-
for (QualType TempQT : QTTypes) {
2222-
// ensure homogeneity
2223-
if (TempQT != FirstQT)
2224-
return false;
2225-
2226-
if (const BuiltinType *BT = TempQT->getAs<BuiltinType>()) {
2227-
if (BT->getKind() == BuiltinType::Bool ||
2228-
BT->getKind() == BuiltinType::Enum)
2229-
return false;
2230-
2231-
// Check if it is an array type.
2232-
if (TempQT->isArrayType())
2233-
return false;
2234-
}
2235-
}
2236-
2237-
// if the loop above completes without returning, then
2238-
// we've guaranteed homogeneity
2239-
int TotalSizeInBytes =
2240-
(SemaRef.Context.getTypeSize(FirstQT) / 8) * QTTypes.size();
2241-
if (TotalSizeInBytes > 16)
2242-
return false;
2243-
2244-
return true;
2245-
}
2246-
22472202
bool SemaHLSL::IsScalarizedLayoutCompatible(QualType T1, QualType T2) const {
22482203
if (T1.isNull() || T2.isNull())
22492204
return false;

clang/test/SemaHLSL/Types/Traits/IsTypedResourceElementCompatible.hlsl

Lines changed: 0 additions & 101 deletions
This file was deleted.

clang/test/SemaHLSL/Types/Traits/IsTypedResourceElementCompatibleErrors.hlsl

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)