[clang] 3ff67d8 - [HLSL] Fix for build break introduced by #85662 (#85839)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 12:04:16 PDT 2024


Author: Farzon Lotfi
Date: 2024-03-19T12:04:12-07:00
New Revision: 3ff67d8c8069b9f42efcbe90ad7edeb6d8117a31

URL: https://github.com/llvm/llvm-project/commit/3ff67d8c8069b9f42efcbe90ad7edeb6d8117a31
DIFF: https://github.com/llvm/llvm-project/commit/3ff67d8c8069b9f42efcbe90ad7edeb6d8117a31.diff

LOG: [HLSL] Fix for build break introduced by #85662 (#85839)

This change fixes a test case failure caused by pr #85662

Added: 
    

Modified: 
    clang/include/clang/AST/Type.h
    clang/lib/Sema/SemaChecking.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 10916053cdfbf5..be18535e3e4c8c 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2245,6 +2245,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
   bool isHalfType() const;         // OpenCL 6.1.1.1, NEON (IEEE 754-2008 half)
   bool isFloat16Type() const;      // C11 extension ISO/IEC TS 18661
   bool isFloat32Type() const;
+  bool isDoubleType() const;
   bool isBFloat16Type() const;
   bool isFloat128Type() const;
   bool isIbm128Type() const;
@@ -7457,6 +7458,10 @@ inline bool Type::isFloat32Type() const {
   return isSpecificBuiltinType(BuiltinType::Float);
 }
 
+inline bool Type::isDoubleType() const {
+  return isSpecificBuiltinType(BuiltinType::Double);
+}
+
 inline bool Type::isBFloat16Type() const {
   return isSpecificBuiltinType(BuiltinType::BFloat16);
 }

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index f9112a29027acd..ef3ab16ba29b41 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5486,10 +5486,8 @@ bool CheckFloatOrHalfRepresentations(Sema *S, CallExpr *TheCall) {
 
 bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) {
   auto checkDoubleVector = [](clang::QualType PassedType) -> bool {
-    if (const auto *VecTy = dyn_cast<VectorType>(PassedType)) {
-      clang::QualType BaseType = VecTy->getElementType();
-      return !BaseType->isHalfType() && !BaseType->isFloat32Type();
-    }
+    if (const auto *VecTy = PassedType->getAs<VectorType>())
+      return VecTy->getElementType()->isDoubleType();
     return false;
   };
   return CheckArgsTypesAreCorrect(S, TheCall, S->Context.FloatTy,


        


More information about the cfe-commits mailing list