[clang] b27bb09 - [AST] Simplify TypeIsArrayType (NFC) (#158784)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 16 09:07:24 PDT 2025


Author: Kazu Hirata
Date: 2025-09-16T09:07:20-07:00
New Revision: b27bb09f6d02e750c4126aeffb7a2ecf0d6ab783

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

LOG: [AST] Simplify TypeIsArrayType (NFC) (#158784)

This patch simplifies replaces TypeIsArrayType.  If
std::is_same<ArrayType, ArrayType> is true, then
std::is_base_of<ArrayType, ArrayType> must also be true, so
std::is_base_of<ArrayType, ArrayType> alone is sufficient.

Added: 
    

Modified: 
    clang/include/clang/AST/TypeBase.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/TypeBase.h b/clang/include/clang/AST/TypeBase.h
index 9074992a3de8c..b02d9c7499fe5 100644
--- a/clang/include/clang/AST/TypeBase.h
+++ b/clang/include/clang/AST/TypeBase.h
@@ -9092,10 +9092,7 @@ inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &PD,
 
 // Helper class template that is used by Type::getAs to ensure that one does
 // not try to look through a qualified type to get to an array type.
-template <typename T>
-using TypeIsArrayType =
-    std::integral_constant<bool, std::is_same<T, ArrayType>::value ||
-                                     std::is_base_of<ArrayType, T>::value>;
+template <typename T> using TypeIsArrayType = std::is_base_of<ArrayType, T>;
 
 // Member-template getAs<specific type>'.
 template <typename T> const T *Type::getAs() const {


        


More information about the cfe-commits mailing list