Skip to content

Commit 3ff67d8

Browse files
authored
[HLSL] Fix for build break introduced by #85662 (#85839)
This change fixes a test case failure caused by pr #85662
1 parent a0394f1 commit 3ff67d8

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

clang/include/clang/AST/Type.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
22452245
bool isHalfType() const; // OpenCL 6.1.1.1, NEON (IEEE 754-2008 half)
22462246
bool isFloat16Type() const; // C11 extension ISO/IEC TS 18661
22472247
bool isFloat32Type() const;
2248+
bool isDoubleType() const;
22482249
bool isBFloat16Type() const;
22492250
bool isFloat128Type() const;
22502251
bool isIbm128Type() const;
@@ -7457,6 +7458,10 @@ inline bool Type::isFloat32Type() const {
74577458
return isSpecificBuiltinType(BuiltinType::Float);
74587459
}
74597460

7461+
inline bool Type::isDoubleType() const {
7462+
return isSpecificBuiltinType(BuiltinType::Double);
7463+
}
7464+
74607465
inline bool Type::isBFloat16Type() const {
74617466
return isSpecificBuiltinType(BuiltinType::BFloat16);
74627467
}

clang/lib/Sema/SemaChecking.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5486,10 +5486,8 @@ bool CheckFloatOrHalfRepresentations(Sema *S, CallExpr *TheCall) {
54865486

54875487
bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) {
54885488
auto checkDoubleVector = [](clang::QualType PassedType) -> bool {
5489-
if (const auto *VecTy = dyn_cast<VectorType>(PassedType)) {
5490-
clang::QualType BaseType = VecTy->getElementType();
5491-
return !BaseType->isHalfType() && !BaseType->isFloat32Type();
5492-
}
5489+
if (const auto *VecTy = PassedType->getAs<VectorType>())
5490+
return VecTy->getElementType()->isDoubleType();
54935491
return false;
54945492
};
54955493
return CheckArgsTypesAreCorrect(S, TheCall, S->Context.FloatTy,

0 commit comments

Comments
 (0)