Skip to content

Commit 300f8e3

Browse files
committed
remove unused function
1 parent 76243df commit 300f8e3

File tree

8 files changed

+109
-111
lines changed

8 files changed

+109
-111
lines changed

clang/include/clang/AST/Type.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,8 +2665,6 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
26652665
bool isHLSLAttributedResourceType() const;
26662666
bool isHLSLIntangibleType()
26672667
const; // Any HLSL intangible type (builtin, array, class)
2668-
bool isHLSLLineVectorLayoutCompatibleType()
2669-
const; // Any HLSL line vector layout compatible type
26702668
/// Determines if this type, which must satisfy
26712669
/// isObjCLifetimeType(), is implicitly __unsafe_unretained rather
26722670
/// than implicitly __strong.

clang/include/clang/Basic/TokenKinds.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ 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_line_vector_layout_compatible, IsLineVectorLayoutCompatibleType, KEYHLSL)
665+
TYPE_TRAIT_1(__builtin_hlsl_is_typed_resource_element_compatible, IsTypedResourceElementCompatible, KEYHLSL)
666666

667667
// OpenMP Type Traits
668668
UNARY_EXPR_OR_TYPE_TRAIT(__builtin_omp_required_simd_align, OpenMPRequiredSimdAlign, KEYALL)

clang/include/clang/Sema/SemaHLSL.h

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

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

137137
bool CheckCompatibleParameterABI(FunctionDecl *New, FunctionDecl *Old);
138138

clang/lib/Sema/SemaExprCXX.cpp

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

50385038
// These traits are modeled on type predicates in C++0x [meta.unary.prop]
@@ -5716,14 +5716,14 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
57165716
return false;
57175717
return T->isHLSLIntangibleType();
57185718

5719-
case UTT_IsLineVectorLayoutCompatibleType:
5719+
case UTT_IsTypedResourceElementCompatible:
57205720
assert(Self.getLangOpts().HLSL &&
57215721
"line vector layout compatible types are HLSL-only feature");
57225722
if (Self.RequireCompleteType(TInfo->getTypeLoc().getBeginLoc(), T,
57235723
diag::err_incomplete_type))
57245724
return false;
57255725

5726-
return Self.HLSL().IsLineVectorLayoutCompatibleType(T);
5726+
return Self.HLSL().IsTypedResourceElementCompatible(T);
57275727
}
57285728
}
57295729

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2163,7 +2163,7 @@ static void BuildFlattenedTypeList(QualType BaseTy,
21632163
}
21642164
}
21652165

2166-
bool SemaHLSL::IsLineVectorLayoutCompatibleType(clang::QualType QT) {
2166+
bool SemaHLSL::IsTypedResourceElementCompatible(clang::QualType QT) {
21672167
if (QT.isNull())
21682168
return false;
21692169

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

Lines changed: 0 additions & 101 deletions
This file was deleted.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.6-library -finclude-default-header -fnative-half-type -verify %s
2+
// expected-no-diagnostics
3+
4+
struct oneInt {
5+
int i;
6+
};
7+
8+
struct twoInt {
9+
int aa;
10+
int ab;
11+
};
12+
13+
struct threeInts {
14+
oneInt o;
15+
twoInt t;
16+
};
17+
18+
struct oneFloat {
19+
float f;
20+
};
21+
struct depthDiff {
22+
int i;
23+
oneInt o;
24+
oneFloat f;
25+
};
26+
27+
struct notHomogenous{
28+
int i;
29+
float f;
30+
};
31+
32+
struct EightElements {
33+
twoInt x[2];
34+
twoInt y[2];
35+
};
36+
37+
struct EightHalves {
38+
half x[8];
39+
};
40+
41+
struct intVec {
42+
int2 i;
43+
};
44+
45+
struct oneIntWithVec {
46+
int i;
47+
oneInt i2;
48+
int2 i3;
49+
};
50+
51+
struct weirdStruct {
52+
int i;
53+
intVec iv;
54+
};
55+
56+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(int), "");
57+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(float), "");
58+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(float4), "");
59+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(double2), "");
60+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(oneInt), "");
61+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(oneFloat), "");
62+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(twoInt), "");
63+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(threeInts), "");
64+
_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(notHomogenous), "");
65+
_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(depthDiff), "");
66+
_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(EightElements), "");
67+
_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(EightHalves), "");
68+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(oneIntWithVec), "");
69+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(weirdStruct), "");
70+
_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(RWBuffer<int>), "");
71+
72+
73+
// arrays not allowed
74+
_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(half[4]), "");
75+
76+
template<typename T> struct TemplatedBuffer {
77+
T a;
78+
__hlsl_resource_t h;
79+
};
80+
_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(TemplatedBuffer<int>), "");
81+
82+
struct MyStruct1 : TemplatedBuffer<float> {
83+
float x;
84+
};
85+
_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(MyStruct1), "");
86+
87+
struct MyStruct2 {
88+
const TemplatedBuffer<float> TB[10];
89+
};
90+
_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(MyStruct2), "");
91+
92+
template<typename T> struct SimpleTemplate {
93+
T a;
94+
};
95+
96+
// though the element type is incomplete, the type trait should still technically return true
97+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(SimpleTemplate<__hlsl_resource_t>), "");
98+
99+
_Static_assert(__builtin_hlsl_is_typed_resource_element_compatible(SimpleTemplate<float>), "");
100+
101+
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
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_line_vector_layout_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'}}
77
struct notComplete;
88
// expected-error@+1{{incomplete type 'notComplete' where a complete type is required}}
9-
_Static_assert(!__builtin_hlsl_is_line_vector_layout_compatible(notComplete), "");
9+
_Static_assert(!__builtin_hlsl_is_typed_resource_element_compatible(notComplete), "");
1010

0 commit comments

Comments
 (0)