[Lldb-commits] [clang] [clang-tools-extra] [lldb] [Clang] [NFC] Rename `isAnyPointerType()` and `getPointeeOrArrayElementType()`. (PR #122938)

via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 14 09:57:05 PST 2025


https://github.com/Sirraide updated https://github.com/llvm/llvm-project/pull/122938

>From 4caca7ae06da82c322c8844cc8214fdba5bd252f Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Mon, 13 Jan 2025 21:22:23 +0100
Subject: [PATCH 1/5] [Clang] [NFC] Rename isAnyPointerType()

---
 .../clang-tidy/bugprone/InfiniteLoopCheck.cpp |  2 +-
 .../cppcoreguidelines/InitVariablesCheck.cpp  |  2 +-
 .../readability/IdentifierNamingCheck.cpp     | 12 ++---
 .../SuspiciousCallArgumentCheck.cpp           |  2 +-
 .../clang-tidy/utils/ExceptionAnalyzer.cpp    |  2 +-
 clang/include/clang/AST/CanonicalType.h       |  2 +-
 clang/include/clang/AST/Type.h                |  8 ++--
 clang/include/clang/ASTMatchers/ASTMatchers.h |  4 +-
 .../Core/PathSensitive/MemRegion.h            |  2 +-
 .../Core/PathSensitive/SMTConv.h              | 10 ++---
 .../Core/PathSensitive/SValBuilder.h          |  3 +-
 .../StaticAnalyzer/Core/PathSensitive/SVals.h |  2 +-
 clang/lib/ARCMigrate/ObjCMT.cpp               |  4 +-
 clang/lib/AST/ASTContext.cpp                  |  6 +--
 clang/lib/AST/Expr.cpp                        |  4 +-
 clang/lib/AST/ExprCXX.cpp                     |  2 +-
 clang/lib/AST/ExprConstant.cpp                |  2 +-
 clang/lib/AST/MicrosoftMangle.cpp             |  2 +-
 clang/lib/Analysis/ThreadSafetyCommon.cpp     |  2 +-
 clang/lib/Analysis/UninitializedValues.cpp    |  2 +-
 clang/lib/CodeGen/CGCall.cpp                  |  2 +-
 clang/lib/CodeGen/CGOpenMPRuntime.cpp         | 18 ++++----
 clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp      |  4 +-
 clang/lib/CodeGen/CGStmtOpenMP.cpp            |  8 ++--
 clang/lib/CodeGen/CodeGenTypes.cpp            |  2 +-
 clang/lib/ExtractAPI/DeclarationFragments.cpp |  2 +-
 clang/lib/Frontend/ASTUnit.cpp                |  2 +-
 clang/lib/Sema/SemaAPINotes.cpp               |  2 +-
 clang/lib/Sema/SemaARM.cpp                    | 20 ++++-----
 clang/lib/Sema/SemaCast.cpp                   | 18 ++++----
 clang/lib/Sema/SemaChecking.cpp               |  8 ++--
 clang/lib/Sema/SemaCodeComplete.cpp           |  2 +-
 clang/lib/Sema/SemaDecl.cpp                   |  6 +--
 clang/lib/Sema/SemaDeclAttr.cpp               | 12 ++---
 clang/lib/Sema/SemaExpr.cpp                   | 44 +++++++++----------
 clang/lib/Sema/SemaExprCXX.cpp                |  6 +--
 clang/lib/Sema/SemaLookup.cpp                 |  2 +-
 clang/lib/Sema/SemaOpenACC.cpp                |  2 +-
 clang/lib/Sema/SemaOpenMP.cpp                 | 28 ++++++------
 clang/lib/Sema/SemaOverload.cpp               | 10 ++---
 clang/lib/Sema/SemaRISCV.cpp                  |  2 +-
 clang/lib/Sema/SemaSYCL.cpp                   |  2 +-
 clang/lib/Sema/SemaTemplateDeduction.cpp      |  2 +-
 clang/lib/Sema/SemaType.cpp                   |  8 ++--
 .../Checkers/CStringChecker.cpp               |  2 +-
 .../Checkers/CheckObjCInstMethSignature.cpp   |  2 +-
 .../Checkers/FuchsiaHandleChecker.cpp         |  2 +-
 .../Checkers/NullabilityChecker.cpp           |  2 +-
 .../Checkers/TrustNonnullChecker.cpp          |  2 +-
 .../Checkers/TrustReturnsNonnullChecker.cpp   |  2 +-
 .../UninitializedObject/UninitializedObject.h |  2 +-
 .../Core/BugReporterVisitors.cpp              |  4 +-
 clang/lib/StaticAnalyzer/Core/CallEvent.cpp   |  4 +-
 clang/lib/StaticAnalyzer/Core/DynamicType.cpp |  4 +-
 clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp |  2 +-
 .../StaticAnalyzer/Core/SimpleSValBuilder.cpp |  2 +-
 .../Transformer/SourceCodeBuilders.cpp        |  2 +-
 clang/lib/Tooling/Transformer/Stencil.cpp     |  4 +-
 .../TypeSystem/Clang/TypeSystemClang.cpp      |  2 +-
 59 files changed, 162 insertions(+), 163 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp
index b7f0c08b2a7d4b..f4c5523184630f 100644
--- a/clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp
@@ -93,7 +93,7 @@ static bool isVarThatIsPossiblyChanged(const Decl *Func, const Stmt *LoopStmt,
       if (T.isVolatileQualified())
         return true;
 
-      if (!T->isAnyPointerType() && !T->isReferenceType())
+      if (!T->isPointerOrObjCObjectPointerType() && !T->isReferenceType())
         break;
 
       T = T->getPointeeType();
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
index 3eef2fd12cc8e5..be1673d5c08c98 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
@@ -95,7 +95,7 @@ void InitVariablesCheck::check(const MatchFinder::MatchResult &Result) {
   else if (TypePtr->isFloatingType()) {
     InitializationString = " = NAN";
     AddMathInclude = true;
-  } else if (TypePtr->isAnyPointerType()) {
+  } else if (TypePtr->isPointerOrObjCObjectPointerType()) {
     if (getLangOpts().CPlusPlus11)
       InitializationString = " = nullptr";
     else
diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index 3f63eec2c51a8c..27031c2d6aeb25 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -1218,7 +1218,7 @@ StyleKind IdentifierNamingCheck::findStyleKind(
       return SK_ConstexprVariable;
 
     if (!Type.isNull() && Type.isConstQualified()) {
-      if (Type.getTypePtr()->isAnyPointerType() &&
+      if (Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
           NamingStyles[SK_ConstantPointerParameter])
         return SK_ConstantPointerParameter;
 
@@ -1232,7 +1232,7 @@ StyleKind IdentifierNamingCheck::findStyleKind(
     if (Decl->isParameterPack() && NamingStyles[SK_ParameterPack])
       return SK_ParameterPack;
 
-    if (!Type.isNull() && Type.getTypePtr()->isAnyPointerType() &&
+    if (!Type.isNull() && Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
         NamingStyles[SK_PointerParameter])
       return SK_PointerParameter;
 
@@ -1508,7 +1508,7 @@ StyleKind IdentifierNamingCheck::findStyleKindForVar(
     if (Var->isStaticDataMember() && NamingStyles[SK_ClassConstant])
       return SK_ClassConstant;
 
-    if (Var->isFileVarDecl() && Type.getTypePtr()->isAnyPointerType() &&
+    if (Var->isFileVarDecl() && Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
         NamingStyles[SK_GlobalConstantPointer])
       return SK_GlobalConstantPointer;
 
@@ -1518,7 +1518,7 @@ StyleKind IdentifierNamingCheck::findStyleKindForVar(
     if (Var->isStaticLocal() && NamingStyles[SK_StaticConstant])
       return SK_StaticConstant;
 
-    if (Var->isLocalVarDecl() && Type.getTypePtr()->isAnyPointerType() &&
+    if (Var->isLocalVarDecl() && Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
         NamingStyles[SK_LocalConstantPointer])
       return SK_LocalConstantPointer;
 
@@ -1535,7 +1535,7 @@ StyleKind IdentifierNamingCheck::findStyleKindForVar(
   if (Var->isStaticDataMember() && NamingStyles[SK_ClassMember])
     return SK_ClassMember;
 
-  if (Var->isFileVarDecl() && Type.getTypePtr()->isAnyPointerType() &&
+  if (Var->isFileVarDecl() && Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
       NamingStyles[SK_GlobalPointer])
     return SK_GlobalPointer;
 
@@ -1545,7 +1545,7 @@ StyleKind IdentifierNamingCheck::findStyleKindForVar(
   if (Var->isStaticLocal() && NamingStyles[SK_StaticVariable])
     return SK_StaticVariable;
 
-  if (Var->isLocalVarDecl() && Type.getTypePtr()->isAnyPointerType() &&
+  if (Var->isLocalVarDecl() && Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
       NamingStyles[SK_LocalPointer])
     return SK_LocalPointer;
 
diff --git a/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp b/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
index c5eaff88e0ed3b..108c8d2e0a29ff 100644
--- a/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
@@ -472,7 +472,7 @@ static bool areTypesCompatible(QualType ArgType, QualType ParamType,
 
   // Unless argument and param are both multilevel pointers, the types are not
   // convertible.
-  if (!(ParamType->isAnyPointerType() && ArgType->isAnyPointerType()))
+  if (!(ParamType->isPointerOrObjCObjectPointerType() && ArgType->isPointerOrObjCObjectPointerType()))
     return false;
 
   return arePointerTypesCompatible(ArgType, ParamType, IsParamContinuouslyConst,
diff --git a/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp b/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
index 0fea7946a59f95..eec39d97a94a72 100644
--- a/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
+++ b/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp
@@ -84,7 +84,7 @@ inline bool isPointerOrPointerToMember(const Type *T) {
 }
 
 std::optional<QualType> getPointeeOrArrayElementQualType(QualType T) {
-  if (T->isAnyPointerType() || T->isMemberPointerType())
+  if (T->isPointerOrObjCObjectPointerType() || T->isMemberPointerType())
     return T->getPointeeType();
 
   if (T->isArrayType())
diff --git a/clang/include/clang/AST/CanonicalType.h b/clang/include/clang/AST/CanonicalType.h
index 6699284d215bd0..8c0b9aa39df941 100644
--- a/clang/include/clang/AST/CanonicalType.h
+++ b/clang/include/clang/AST/CanonicalType.h
@@ -286,7 +286,7 @@ class CanProxyBase {
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isDerivedType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isScalarType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAggregateType)
-  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isAnyPointerType)
+  LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isPointerOrObjCObjectPointerType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isVoidPointerType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isFunctionPointerType)
   LLVM_CLANG_CANPROXY_SIMPLE_ACCESSOR(bool, isMemberFunctionPointerType)
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 78677df578c4bc..fed1647da43534 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2536,7 +2536,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
   bool isPointerType() const;
   bool isPointerOrReferenceType() const;
   bool isSignableType() const;
-  bool isAnyPointerType() const;   // Any C pointer or ObjC object pointer
+  bool isPointerOrObjCObjectPointerType() const;   // Any C pointer or ObjC object pointer
   bool isCountAttributedType() const;
   bool isBlockPointerType() const;
   bool isVoidPointerType() const;
@@ -8196,7 +8196,7 @@ inline bool Type::isPointerOrReferenceType() const {
   return isPointerType() || isReferenceType();
 }
 
-inline bool Type::isAnyPointerType() const {
+inline bool Type::isPointerOrObjCObjectPointerType() const {
   return isPointerType() || isObjCObjectPointerType();
 }
 
@@ -8656,7 +8656,7 @@ inline bool Type::isUndeducedType() const {
 inline bool Type::isOverloadableType() const {
   if (!isDependentType())
     return isRecordType() || isEnumeralType();
-  return !isArrayType() && !isFunctionType() && !isAnyPointerType() &&
+  return !isArrayType() && !isFunctionType() && !isPointerOrObjCObjectPointerType() &&
          !isMemberPointerType();
 }
 
@@ -8692,7 +8692,7 @@ inline const Type *Type::getBaseElementTypeUnsafe() const {
 
 inline const Type *Type::getPointeeOrArrayElementType() const {
   const Type *type = this;
-  if (type->isAnyPointerType())
+  if (type->isPointerOrObjCObjectPointerType())
     return type->getPointeeType().getTypePtr();
   else if (type->isArrayType())
     return type->getBaseElementTypeUnsafe();
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h
index 239fcba4e5e057..d9f505c5645f06 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -4156,7 +4156,7 @@ AST_MATCHER_P(QualType, asString, std::string, Name) {
 AST_MATCHER_P(
     QualType, pointsTo, internal::Matcher<QualType>,
     InnerMatcher) {
-  return (!Node.isNull() && Node->isAnyPointerType() &&
+  return (!Node.isNull() && Node->isPointerOrObjCObjectPointerType() &&
           InnerMatcher.matches(Node->getPointeeType(), Finder, Builder));
 }
 
@@ -6605,7 +6605,7 @@ AST_MATCHER(QualType, isAnyCharacter) {
 /// varDecl(hasType(isAnyPointer()))
 ///   matches "int *i" and "Foo *f", but not "int j".
 AST_MATCHER(QualType, isAnyPointer) {
-  return Node->isAnyPointerType();
+  return Node->isPointerOrObjCObjectPointerType();
 }
 
 /// Matches QualType nodes that are const-qualified, i.e., that
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
index f88bf70d72398c..15e01bdbcd6ed5 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
@@ -787,7 +787,7 @@ class SymbolicRegion : public SubRegion {
     // Because pointer arithmetic is represented by ElementRegion layers,
     // the base symbol here should not contain any arithmetic.
     assert(isa_and_nonnull<SymbolData>(s));
-    assert(s->getType()->isAnyPointerType() ||
+    assert(s->getType()->isPointerOrObjCObjectPointerType() ||
            s->getType()->isReferenceType() ||
            s->getType()->isBlockPointerType());
     assert(isa<UnknownSpaceRegion>(sreg) || isa<HeapSpaceRegion>(sreg) ||
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h
index fcc9c02999b3b0..ef5bf4b50371db 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h
@@ -264,7 +264,7 @@ class SMTConv {
                                           uint64_t FromBitWidth) {
     if ((FromTy->isIntegralOrEnumerationType() &&
          ToTy->isIntegralOrEnumerationType()) ||
-        (FromTy->isAnyPointerType() ^ ToTy->isAnyPointerType()) ||
+        (FromTy->isPointerOrObjCObjectPointerType() ^ ToTy->isPointerOrObjCObjectPointerType()) ||
         (FromTy->isBlockPointerType() ^ ToTy->isBlockPointerType()) ||
         (FromTy->isReferenceType() ^ ToTy->isReferenceType())) {
 
@@ -365,7 +365,7 @@ class SMTConv {
 
       // If the two operands are pointers and the operation is a subtraction,
       // the result is of type ptrdiff_t, which is signed
-      if (LTy->isAnyPointerType() && RTy->isAnyPointerType() && Op == BO_Sub) {
+      if (LTy->isPointerOrObjCObjectPointerType() && RTy->isPointerOrObjCObjectPointerType() && Op == BO_Sub) {
         *RetTy = Ctx.getPointerDiffType();
       }
     }
@@ -509,7 +509,7 @@ class SMTConv {
                             Solver->mkFloat(Zero));
     }
 
-    if (Ty->isIntegralOrEnumerationType() || Ty->isAnyPointerType() ||
+    if (Ty->isIntegralOrEnumerationType() || Ty->isPointerOrObjCObjectPointerType() ||
         Ty->isBlockPointerType() || Ty->isReferenceType()) {
 
       // Skip explicit comparison for boolean types
@@ -613,7 +613,7 @@ class SMTConv {
       return;
     }
 
-    if ((LTy->isAnyPointerType() || RTy->isAnyPointerType()) ||
+    if ((LTy->isPointerOrObjCObjectPointerType() || RTy->isPointerOrObjCObjectPointerType()) ||
         (LTy->isBlockPointerType() || RTy->isBlockPointerType()) ||
         (LTy->isReferenceType() || RTy->isReferenceType())) {
       // TODO: Refactor to Sema::FindCompositePointerType(), and
@@ -624,7 +624,7 @@ class SMTConv {
 
       // Cast the non-pointer type to the pointer type.
       // TODO: Be more strict about this.
-      if ((LTy->isAnyPointerType() ^ RTy->isAnyPointerType()) ||
+      if ((LTy->isPointerOrObjCObjectPointerType() ^ RTy->isPointerOrObjCObjectPointerType()) ||
           (LTy->isBlockPointerType() ^ RTy->isBlockPointerType()) ||
           (LTy->isReferenceType() ^ RTy->isReferenceType())) {
         if (LTy->isNullPtrType() || LTy->isBlockPointerType() ||
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
index 54430d426a82a8..93e6b08644807a 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
@@ -356,8 +356,7 @@ class SValBuilder {
   /// space.
   /// \param type pointer type.
   loc::ConcreteInt makeNullWithType(QualType type) {
-    // We cannot use the `isAnyPointerType()`.
-    assert((type->isPointerType() || type->isObjCObjectPointerType() ||
+    assert((type->isPointerOrObjCObjectPointerType() ||
             type->isBlockPointerType() || type->isNullPtrType() ||
             type->isReferenceType()) &&
            "makeNullWithType must use pointer type");
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
index aeb57b28077c61..c6c6951ba32198 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -260,7 +260,7 @@ class Loc : public DefinedSVal {
   void dumpToStream(raw_ostream &Out) const;
 
   static bool isLocType(QualType T) {
-    return T->isAnyPointerType() || T->isBlockPointerType() ||
+    return T->isPointerOrObjCObjectPointerType() || T->isBlockPointerType() ||
            T->isReferenceType() || T->isNullPtrType();
   }
 
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp
index c1bc7c762088f2..47c130379d5126 100644
--- a/clang/lib/ARCMigrate/ObjCMT.cpp
+++ b/clang/lib/ARCMigrate/ObjCMT.cpp
@@ -1042,7 +1042,7 @@ void ObjCMigrateASTConsumer::migrateMethodInstanceType(ASTContext &Ctx,
 }
 
 static bool TypeIsInnerPointer(QualType T) {
-  if (!T->isAnyPointerType())
+  if (!T->isPointerOrObjCObjectPointerType())
     return false;
   if (T->isObjCObjectPointerType() || T->isObjCBuiltinType() ||
       T->isBlockPointerType() || T->isFunctionPointerType() ||
@@ -1366,7 +1366,7 @@ static bool IsVoidStarType(QualType Ty) {
 /// CF object types or of the "void *" variety. It returns true if we don't care about the type
 /// such as a non-pointer or pointers which have no ownership issues (such as "int *").
 static bool AuditedType (QualType AT) {
-  if (!AT->isAnyPointerType() && !AT->isBlockPointerType())
+  if (!AT->isPointerOrObjCObjectPointerType() && !AT->isBlockPointerType())
     return true;
   // FIXME. There isn't much we can say about CF pointer type; or is there?
   if (ento::coreFoundation::isCFObjectRef(AT) ||
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index be1dd29d462788..d6fdb035294068 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -2980,7 +2980,7 @@ bool ASTContext::isSentinelNullExpr(const Expr *E) {
   // nullptr_t is always treated as null.
   if (E->getType()->isNullPtrType()) return true;
 
-  if (E->getType()->isAnyPointerType() &&
+  if (E->getType()->isPointerOrObjCObjectPointerType() &&
       E->IgnoreParenCasts()->isNullPointerConstant(*this,
                                                 Expr::NPC_ValueDependentIsNull))
     return true;
@@ -3518,7 +3518,7 @@ QualType ASTContext::getObjCGCQualType(QualType T,
 
   if (const auto *ptr = T->getAs<PointerType>()) {
     QualType Pointee = ptr->getPointeeType();
-    if (Pointee->isAnyPointerType()) {
+    if (Pointee->isPointerOrObjCObjectPointerType()) {
       QualType ResultType = getObjCGCQualType(Pointee, GCAttr);
       return getPointerType(ResultType);
     }
@@ -10101,7 +10101,7 @@ Qualifiers::GC ASTContext::getObjCGCAttrKind(QualType Ty) const {
     QualType CT = Ty->getCanonicalTypeInternal();
     while (const auto *AT = dyn_cast<ArrayType>(CT))
       CT = AT->getElementType();
-    assert(CT->isAnyPointerType() || CT->isBlockPointerType());
+    assert(CT->isPointerOrObjCObjectPointerType() || CT->isBlockPointerType());
 #endif
   }
   return GCAttrs;
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index f6a4ed970cb23f..b7de5a5b9e6232 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1872,7 +1872,7 @@ bool CastExpr::CastConsistency() const {
 
   case CK_AnyPointerToBlockPointerCast:
     assert(getType()->isBlockPointerType());
-    assert(getSubExpr()->getType()->isAnyPointerType() &&
+    assert(getSubExpr()->getType()->isPointerOrObjCObjectPointerType() &&
            !getSubExpr()->getType()->isBlockPointerType());
     goto CheckNoBasePath;
 
@@ -5199,7 +5199,7 @@ QualType ArraySectionExpr::getBaseOriginalType(const Expr *Base) {
       OriginalTy = PVD->getOriginalType().getNonReferenceType();
 
   for (unsigned Cnt = 0; Cnt < ArraySectionCount; ++Cnt) {
-    if (OriginalTy->isAnyPointerType())
+    if (OriginalTy->isPointerOrObjCObjectPointerType())
       OriginalTy = OriginalTy->getPointeeType();
     else if (OriginalTy->isArrayType())
       OriginalTy = OriginalTy->castAsArrayTypeUnsafe()->getElementType();
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index 5bf5d6adf525a8..dd7d09f7833672 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -733,7 +733,7 @@ CXXRecordDecl *CXXMemberCallExpr::getRecordDecl() const {
   if (!ThisArg)
     return nullptr;
 
-  if (ThisArg->getType()->isAnyPointerType())
+  if (ThisArg->getType()->isPointerOrObjCObjectPointerType())
     return ThisArg->getType()->getPointeeType()->getAsCXXRecordDecl();
 
   return ThisArg->getType()->getAsCXXRecordDecl();
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 2e680d1569f60f..c596a29b479480 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -2361,7 +2361,7 @@ static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc,
   if (auto *FD = dyn_cast_or_null<FunctionDecl>(BaseVD);
       FD && FD->isImmediateFunction()) {
     Info.FFDiag(Loc, diag::note_consteval_address_accessible)
-        << !Type->isAnyPointerType();
+        << !Type->isPointerOrObjCObjectPointerType();
     Info.Note(FD->getLocation(), diag::note_declared_at);
     return false;
   }
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index edeeaeaa9ae17c..63a1a53c4e74a1 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -2570,7 +2570,7 @@ void MicrosoftCXXNameMangler::mangleType(QualType T, SourceRange Range,
     return;
   }
 
-  bool IsPointer = T->isAnyPointerType() || T->isMemberPointerType() ||
+  bool IsPointer = T->isPointerOrObjCObjectPointerType() || T->isMemberPointerType() ||
                    T->isReferenceType() || T->isBlockPointerType();
 
   switch (QMM) {
diff --git a/clang/lib/Analysis/ThreadSafetyCommon.cpp b/clang/lib/Analysis/ThreadSafetyCommon.cpp
index 13cd7e26dc16f3..19030477842236 100644
--- a/clang/lib/Analysis/ThreadSafetyCommon.cpp
+++ b/clang/lib/Analysis/ThreadSafetyCommon.cpp
@@ -383,7 +383,7 @@ static const ValueDecl *getValueDeclFromSExpr(const til::SExpr *E) {
 
 static bool hasAnyPointerType(const til::SExpr *E) {
   auto *VD = getValueDeclFromSExpr(E);
-  if (VD && VD->getType()->isAnyPointerType())
+  if (VD && VD->getType()->isPointerOrObjCObjectPointerType())
     return true;
   if (const auto *C = dyn_cast<til::Cast>(E))
     return C->castOpcode() == til::CAST_objToPtr;
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp
index bf2f7306186507..ad6870f49dd993 100644
--- a/clang/lib/Analysis/UninitializedValues.cpp
+++ b/clang/lib/Analysis/UninitializedValues.cpp
@@ -417,7 +417,7 @@ void ClassifyRefs::VisitOMPExecutableDirective(OMPExecutableDirective *ED) {
 }
 
 static bool isPointerToConst(const QualType &QT) {
-  return QT->isAnyPointerType() && QT->getPointeeType().isConstQualified();
+  return QT->isPointerOrObjCObjectPointerType() && QT->getPointeeType().isConstQualified();
 }
 
 static bool hasTrivialBody(CallExpr *CE) {
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 0fde4d8ee296bd..4840f1af5c201f 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2929,7 +2929,7 @@ static const NonNullAttr *getNonNullAttr(const Decl *FD, const ParmVarDecl *PVD,
   // In the former case, LLVM IR cannot represent the constraint. In
   // the latter case, we have no guarantee that the transparent union
   // is in fact passed as a pointer.
-  if (!ArgType->isAnyPointerType() && !ArgType->isBlockPointerType())
+  if (!ArgType->isPointerOrObjCObjectPointerType() && !ArgType->isBlockPointerType())
     return nullptr;
   // First, check attribute on parameter itself.
   if (PVD) {
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 1868b57cea9039..f61c2f9d32861c 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -7067,7 +7067,7 @@ class MappableExprsHandler {
       // reference. References are ignored for mapping purposes.
       QualType Ty =
           I->getAssociatedDeclaration()->getType().getNonReferenceType();
-      if (Ty->isAnyPointerType() && std::next(I) != CE) {
+      if (Ty->isPointerOrObjCObjectPointerType() && std::next(I) != CE) {
         // No need to generate individual map information for the pointer, it
         // can be associated with the combined storage if shared memory mode is
         // active or the base declaration is not global variable.
@@ -7192,8 +7192,8 @@ class MappableExprsHandler {
           OAShE ||
           (OASE && ArraySectionExpr::getBaseOriginalType(OASE)
                        .getCanonicalType()
-                       ->isAnyPointerType()) ||
-          I->getAssociatedExpression()->getType()->isAnyPointerType();
+                       ->isPointerOrObjCObjectPointerType()) ||
+          I->getAssociatedExpression()->getType()->isPointerOrObjCObjectPointerType();
       bool IsMemberReference = isa<MemberExpr>(I->getAssociatedExpression()) &&
                                MapDecl &&
                                MapDecl->getType()->isLValueReferenceType();
@@ -7687,7 +7687,7 @@ class MappableExprsHandler {
     // 'private ptr' and 'map to' flag. Return the right flags if the captured
     // declaration is known as first-private in this handler.
     if (FirstPrivateDecls.count(Cap.getCapturedVar())) {
-      if (Cap.getCapturedVar()->getType()->isAnyPointerType())
+      if (Cap.getCapturedVar()->getType()->isPointerOrObjCObjectPointerType())
         return OpenMPOffloadMappingFlags::OMP_MAP_TO |
                OpenMPOffloadMappingFlags::OMP_MAP_PTR_AND_OBJ;
       return OpenMPOffloadMappingFlags::OMP_MAP_PRIVATE |
@@ -8032,7 +8032,7 @@ class MappableExprsHandler {
       const ValueDecl *VD = cast_or_null<ValueDecl>(D);
       bool HasMapBasePtr = false;
       bool HasMapArraySec = false;
-      if (VD && VD->getType()->isAnyPointerType()) {
+      if (VD && VD->getType()->isPointerOrObjCObjectPointerType()) {
         for (const auto &M : Data.second) {
           HasMapBasePtr = any_of(M, [](const MapInfo &L) {
             return isa_and_present<DeclRefExpr>(L.VarRef);
@@ -8533,9 +8533,9 @@ class MappableExprsHandler {
         assert(VDecl == VD && "We got information for the wrong declaration??");
         assert(!Components.empty() &&
                "Not expecting declaration with no component lists.");
-        if (VD && E && VD->getType()->isAnyPointerType() && isa<DeclRefExpr>(E))
+        if (VD && E && VD->getType()->isPointerOrObjCObjectPointerType() && isa<DeclRefExpr>(E))
           HasMapBasePtr = true;
-        if (VD && E && VD->getType()->isAnyPointerType() &&
+        if (VD && E && VD->getType()->isPointerOrObjCObjectPointerType() &&
             (isa<ArraySectionExpr>(E) || isa<ArraySubscriptExpr>(E)))
           HasMapArraySec = true;
         DeclComponentLists.emplace_back(Components, C->getMapType(),
@@ -8752,7 +8752,7 @@ class MappableExprsHandler {
       CombinedInfo.DevicePtrDecls.push_back(nullptr);
       CombinedInfo.DevicePointers.push_back(DeviceInfoTy::None);
       CombinedInfo.Pointers.push_back(CV);
-      if (!RI.getType()->isAnyPointerType()) {
+      if (!RI.getType()->isPointerOrObjCObjectPointerType()) {
         // We have to signal to the runtime captures passed by value that are
         // not pointers.
         CombinedInfo.Types.push_back(
@@ -8784,7 +8784,7 @@ class MappableExprsHandler {
       CombinedInfo.BasePointers.push_back(CV);
       CombinedInfo.DevicePtrDecls.push_back(nullptr);
       CombinedInfo.DevicePointers.push_back(DeviceInfoTy::None);
-      if (I != FirstPrivateDecls.end() && ElementType->isAnyPointerType()) {
+      if (I != FirstPrivateDecls.end() && ElementType->isPointerOrObjCObjectPointerType()) {
         Address PtrAddr = CGF.EmitLoadOfReference(CGF.MakeAddrLValue(
             CV, ElementType, CGF.getContext().getDeclAlign(VD),
             AlignmentSource::Decl));
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index dbb19f2a8d825a..23389a45e2639a 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -216,7 +216,7 @@ class CheckVarsEscapingDeclContext final
           if (((Attr->getCaptureKind() != OMPC_map) &&
                !isOpenMPPrivate(Attr->getCaptureKind())) ||
               ((Attr->getCaptureKind() == OMPC_map) &&
-               !FD->getType()->isAnyPointerType()))
+               !FD->getType()->isPointerOrObjCObjectPointerType()))
             return;
         }
         if (!FD->getType()->isReferenceType()) {
@@ -1962,7 +1962,7 @@ llvm::Function *CGOpenMPRuntimeGPU::createParallelDataSharingWrapper(
                                               CGFContext.getPointerType(ElemTy),
                                               CI->getLocation());
       if (CI->capturesVariableByCopy() &&
-          !CI->getCapturedVar()->getType()->isAnyPointerType()) {
+          !CI->getCapturedVar()->getType()->isPointerOrObjCObjectPointerType()) {
         Arg = castValueToType(CGF, Arg, ElemTy, CGFContext.getUIntPtrType(),
                               CI->getLocation());
       }
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 2b4ca65e169a6e..d21ef3acd6b380 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -394,7 +394,7 @@ void CodeGenFunction::GenerateOpenMPCapturedVars(
 
       // If the field is not a pointer, we need to save the actual value
       // and load it as a void pointer.
-      if (!CurField->getType()->isAnyPointerType()) {
+      if (!CurField->getType()->isPointerOrObjCObjectPointerType()) {
         ASTContext &Ctx = getContext();
         Address DstAddr = CreateMemTemp(
             Ctx.getUIntPtrType(),
@@ -520,7 +520,7 @@ static llvm::Function *emitOutlinedFunctionPrologue(
     // deal with pointers. We can pass in the same way the VLA type sizes to the
     // outlined function.
     if (FO.UIntPtrCastRequired &&
-        ((I->capturesVariableByCopy() && !ArgType->isAnyPointerType()) ||
+        ((I->capturesVariableByCopy() && !ArgType->isPointerOrObjCObjectPointerType()) ||
          I->capturesVariableArrayType()))
       ArgType = Ctx.getUIntPtrType();
 
@@ -601,7 +601,7 @@ static llvm::Function *emitOutlinedFunctionPrologue(
     }
     // If we are capturing a pointer by copy we don't need to do anything, just
     // use the value that we get from the arguments.
-    if (I->capturesVariableByCopy() && FD->getType()->isAnyPointerType()) {
+    if (I->capturesVariableByCopy() && FD->getType()->isPointerOrObjCObjectPointerType()) {
       const VarDecl *CurVD = I->getCapturedVar();
       if (!FO.RegisterCastedArgsOnly)
         LocalAddrs.insert({Args[Cnt], {CurVD, LocalAddr}});
@@ -638,7 +638,7 @@ static llvm::Function *emitOutlinedFunctionPrologue(
             {Args[Cnt], {Var, ArgAddr.withAlignment(Ctx.getDeclAlign(Var))}});
       }
     } else if (I->capturesVariableByCopy()) {
-      assert(!FD->getType()->isAnyPointerType() &&
+      assert(!FD->getType()->isPointerOrObjCObjectPointerType() &&
              "Not expecting a captured pointer.");
       const VarDecl *Var = I->getCapturedVar();
       LocalAddrs.insert({Args[Cnt],
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index 09191a4901f493..90deed4d48db7e 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -832,7 +832,7 @@ CodeGenTypes::getCGRecordLayout(const RecordDecl *RD) {
 }
 
 bool CodeGenTypes::isPointerZeroInitializable(QualType T) {
-  assert((T->isAnyPointerType() || T->isBlockPointerType()) && "Invalid type");
+  assert((T->isPointerOrObjCObjectPointerType() || T->isBlockPointerType()) && "Invalid type");
   return isZeroInitializable(T);
 }
 
diff --git a/clang/lib/ExtractAPI/DeclarationFragments.cpp b/clang/lib/ExtractAPI/DeclarationFragments.cpp
index 66c03863293c2f..9057a1247f0edd 100644
--- a/clang/lib/ExtractAPI/DeclarationFragments.cpp
+++ b/clang/lib/ExtractAPI/DeclarationFragments.cpp
@@ -513,7 +513,7 @@ DeclarationFragments DeclarationFragmentsBuilder::getFragmentsForType(
   // ^----------------     ^
   //  pointer to const int
   // ```
-  if (SQT.Ty->isAnyPointerType())
+  if (SQT.Ty->isPointerOrObjCObjectPointerType())
     return TypeFragments.appendSpace().append(std::move(QualsFragments));
 
   return QualsFragments.appendSpace().append(std::move(TypeFragments));
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 8df5465ad990da..5aa578c8876e3a 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -2137,7 +2137,7 @@ void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S,
       if (C->Kind == CXCursor_MacroDefinition) {
         Priority = getMacroUsagePriority(C->Completion->getTypedText(),
                                          S.getLangOpts(),
-                               Context.getPreferredType()->isAnyPointerType());
+                               Context.getPreferredType()->isPointerOrObjCObjectPointerType());
       } else if (C->Type) {
         CanQualType Expected
           = S.Context.getCanonicalType(
diff --git a/clang/lib/Sema/SemaAPINotes.cpp b/clang/lib/Sema/SemaAPINotes.cpp
index 4f79775bc5e913..5cbee667924cd5 100644
--- a/clang/lib/Sema/SemaAPINotes.cpp
+++ b/clang/lib/Sema/SemaAPINotes.cpp
@@ -48,7 +48,7 @@ static bool isIndirectPointerType(QualType Type) {
   if (Pointee.isNull())
     return false;
 
-  return Pointee->isAnyPointerType() || Pointee->isObjCObjectPointerType() ||
+  return Pointee->isPointerOrObjCObjectPointerType() || Pointee->isObjCObjectPointerType() ||
          Pointee->isMemberPointerType();
 }
 
diff --git a/clang/lib/Sema/SemaARM.cpp b/clang/lib/Sema/SemaARM.cpp
index db418d80e0e09c..82d5e33a7e8078 100644
--- a/clang/lib/Sema/SemaARM.cpp
+++ b/clang/lib/Sema/SemaARM.cpp
@@ -37,7 +37,7 @@ bool SemaARM::BuiltinARMMemoryTaggingCall(unsigned BuiltinID,
     if (FirstArg.isInvalid())
       return true;
     QualType FirstArgType = FirstArg.get()->getType();
-    if (!FirstArgType->isAnyPointerType())
+    if (!FirstArgType->isPointerOrObjCObjectPointerType())
       return Diag(TheCall->getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
              << "first" << FirstArgType << Arg0->getSourceRange();
     TheCall->setArg(0, FirstArg.get());
@@ -64,7 +64,7 @@ bool SemaARM::BuiltinARMMemoryTaggingCall(unsigned BuiltinID,
     if (FirstArg.isInvalid())
       return true;
     QualType FirstArgType = FirstArg.get()->getType();
-    if (!FirstArgType->isAnyPointerType())
+    if (!FirstArgType->isPointerOrObjCObjectPointerType())
       return Diag(TheCall->getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
              << "first" << FirstArgType << Arg0->getSourceRange();
     TheCall->setArg(0, FirstArg.get());
@@ -86,7 +86,7 @@ bool SemaARM::BuiltinARMMemoryTaggingCall(unsigned BuiltinID,
     if (FirstArg.isInvalid())
       return true;
     QualType FirstArgType = FirstArg.get()->getType();
-    if (!FirstArgType->isAnyPointerType())
+    if (!FirstArgType->isPointerOrObjCObjectPointerType())
       return Diag(TheCall->getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
              << "first" << FirstArgType << Arg0->getSourceRange();
 
@@ -108,7 +108,7 @@ bool SemaARM::BuiltinARMMemoryTaggingCall(unsigned BuiltinID,
       return true;
 
     QualType FirstArgType = FirstArg.get()->getType();
-    if (!FirstArgType->isAnyPointerType())
+    if (!FirstArgType->isPointerOrObjCObjectPointerType())
       return Diag(TheCall->getBeginLoc(), diag::err_memtag_arg_must_be_pointer)
              << "first" << FirstArgType << Arg0->getSourceRange();
     TheCall->setArg(0, FirstArg.get());
@@ -138,17 +138,17 @@ bool SemaARM::BuiltinARMMemoryTaggingCall(unsigned BuiltinID,
     };
 
     // argument should be either a pointer or null
-    if (!ArgTypeA->isAnyPointerType() && !isNull(ArgA))
+    if (!ArgTypeA->isPointerOrObjCObjectPointerType() && !isNull(ArgA))
       return Diag(TheCall->getBeginLoc(), diag::err_memtag_arg_null_or_pointer)
              << "first" << ArgTypeA << ArgA->getSourceRange();
 
-    if (!ArgTypeB->isAnyPointerType() && !isNull(ArgB))
+    if (!ArgTypeB->isPointerOrObjCObjectPointerType() && !isNull(ArgB))
       return Diag(TheCall->getBeginLoc(), diag::err_memtag_arg_null_or_pointer)
              << "second" << ArgTypeB << ArgB->getSourceRange();
 
     // Ensure Pointee types are compatible
-    if (ArgTypeA->isAnyPointerType() && !isNull(ArgA) &&
-        ArgTypeB->isAnyPointerType() && !isNull(ArgB)) {
+    if (ArgTypeA->isPointerOrObjCObjectPointerType() && !isNull(ArgA) &&
+        ArgTypeB->isPointerOrObjCObjectPointerType() && !isNull(ArgB)) {
       QualType pointeeA = ArgTypeA->getPointeeType();
       QualType pointeeB = ArgTypeB->getPointeeType();
       if (!Context.typesAreCompatible(
@@ -162,7 +162,7 @@ bool SemaARM::BuiltinARMMemoryTaggingCall(unsigned BuiltinID,
     }
 
     // at least one argument should be pointer type
-    if (!ArgTypeA->isAnyPointerType() && !ArgTypeB->isAnyPointerType())
+    if (!ArgTypeA->isPointerOrObjCObjectPointerType() && !ArgTypeB->isPointerOrObjCObjectPointerType())
       return Diag(TheCall->getBeginLoc(), diag::err_memtag_any2arg_pointer)
              << ArgTypeA << ArgTypeB << ArgA->getSourceRange();
 
@@ -924,7 +924,7 @@ bool SemaARM::CheckARMBuiltinExclusiveCall(unsigned BuiltinID,
   TheCall->setArg(IsLdrex ? 0 : 1, PointerArg);
 
   // In general, we allow ints, floats and pointers to be loaded and stored.
-  if (!ValType->isIntegerType() && !ValType->isAnyPointerType() &&
+  if (!ValType->isIntegerType() && !ValType->isPointerOrObjCObjectPointerType() &&
       !ValType->isBlockPointerType() && !ValType->isFloatingType()) {
     Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intfltptr)
         << PointerArg->getType() << 0 << PointerArg->getSourceRange();
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index f98857f852b5af..bcc777ec62bc3b 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -596,7 +596,7 @@ static CastAwayConstnessKind
 unwrapCastAwayConstnessLevel(ASTContext &Context, QualType &T1, QualType &T2) {
   enum { None, Ptr, MemPtr, BlockPtr, Array };
   auto Classify = [](QualType T) {
-    if (T->isAnyPointerType()) return Ptr;
+    if (T->isPointerOrObjCObjectPointerType()) return Ptr;
     if (T->isMemberPointerType()) return MemPtr;
     if (T->isBlockPointerType()) return BlockPtr;
     // We somewhat-arbitrarily don't look through VLA types here. This is at
@@ -682,10 +682,10 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
     return CastAwayConstnessKind::CACK_None;
 
   if (!DestType->isReferenceType()) {
-    assert((SrcType->isAnyPointerType() || SrcType->isMemberPointerType() ||
+    assert((SrcType->isPointerOrObjCObjectPointerType() || SrcType->isMemberPointerType() ||
             SrcType->isBlockPointerType()) &&
            "Source type is not pointer or pointer to member.");
-    assert((DestType->isAnyPointerType() || DestType->isMemberPointerType() ||
+    assert((DestType->isPointerOrObjCObjectPointerType() || DestType->isMemberPointerType() ||
             DestType->isBlockPointerType()) &&
            "Destination type is not pointer or pointer to member.");
   }
@@ -2450,7 +2450,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
     Kind = CK_NoOp;
     TryCastResult Result = TC_NotApplicable;
     if (SrcType->isIntegralOrEnumerationType() ||
-        SrcType->isAnyPointerType() ||
+        SrcType->isPointerOrObjCObjectPointerType() ||
         SrcType->isMemberPointerType() ||
         SrcType->isBlockPointerType()) {
       Result = TC_Success;
@@ -2458,9 +2458,9 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
     return Result;
   }
 
-  bool destIsPtr = DestType->isAnyPointerType() ||
+  bool destIsPtr = DestType->isPointerOrObjCObjectPointerType() ||
                    DestType->isBlockPointerType();
-  bool srcIsPtr = SrcType->isAnyPointerType() ||
+  bool srcIsPtr = SrcType->isPointerOrObjCObjectPointerType() ||
                   SrcType->isBlockPointerType();
   if (!destIsPtr && !srcIsPtr) {
     // Except for std::nullptr_t->integer and lvalue->reference, which are
@@ -2902,8 +2902,8 @@ static void DiagnoseBadFunctionCast(Sema &Self, const ExprResult &SrcExpr,
   QualType SrcType = SrcExpr.get()->getType();
   if (DestType.getUnqualifiedType()->isVoidType())
     return;
-  if ((SrcType->isAnyPointerType() || SrcType->isBlockPointerType())
-      && (DestType->isAnyPointerType() || DestType->isBlockPointerType()))
+  if ((SrcType->isPointerOrObjCObjectPointerType() || SrcType->isBlockPointerType())
+      && (DestType->isPointerOrObjCObjectPointerType() || DestType->isBlockPointerType()))
     return;
   if (SrcType->isIntegerType() && DestType->isIntegerType() &&
       (SrcType->isBooleanType() == DestType->isBooleanType()) &&
@@ -3318,7 +3318,7 @@ static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr,
     return;
 
   QualType SrcType = SrcExpr.get()->getType();
-  if (!((SrcType->isAnyPointerType() && DestType->isAnyPointerType()) ||
+  if (!((SrcType->isPointerOrObjCObjectPointerType() && DestType->isPointerOrObjCObjectPointerType()) ||
         DestType->isLValueReferenceType()))
     return;
 
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 881907ac311a30..629938ea30d6bb 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -2571,7 +2571,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
     bool ReturnsPointer = BuiltinID == Builtin::BIaddressof ||
                           BuiltinID == Builtin::BI__addressof;
     if (!(Param->isReferenceType() &&
-          (ReturnsPointer ? Result->isAnyPointerType()
+          (ReturnsPointer ? Result->isPointerOrObjCObjectPointerType()
                           : Result->isReferenceType()) &&
           Context.hasSameUnqualifiedType(Param->getPointeeType(),
                                          Result->getPointeeType()))) {
@@ -4281,7 +4281,7 @@ ExprResult Sema::BuiltinAtomicOverloaded(ExprResult TheCallResult) {
   }
 
   QualType ValType = pointerType->getPointeeType();
-  if (!ValType->isIntegerType() && !ValType->isAnyPointerType() &&
+  if (!ValType->isIntegerType() && !ValType->isPointerOrObjCObjectPointerType() &&
       !ValType->isBlockPointerType()) {
     Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intptr)
         << FirstArg->getType() << 0 << FirstArg->getSourceRange();
@@ -4658,7 +4658,7 @@ ExprResult Sema::BuiltinNontemporalOverloaded(ExprResult TheCallResult) {
 
   // Strip any qualifiers off ValType.
   ValType = ValType.getUnqualifiedType();
-  if (!ValType->isIntegerType() && !ValType->isAnyPointerType() &&
+  if (!ValType->isIntegerType() && !ValType->isPointerOrObjCObjectPointerType() &&
       !ValType->isBlockPointerType() && !ValType->isFloatingType() &&
       !ValType->isVectorType()) {
     Diag(DRE->getBeginLoc(),
@@ -10950,7 +10950,7 @@ static void DiagnoseNullConversion(Sema &S, Expr *E, QualType T,
     return;
 
   // Return if target type is a safe conversion.
-  if (T->isAnyPointerType() || T->isBlockPointerType() ||
+  if (T->isPointerOrObjCObjectPointerType() || T->isBlockPointerType() ||
       T->isMemberPointerType() || !T->isScalarType() || T->isNullPtrType())
     return;
 
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 1f398bb004fa30..91ee9685f6f750 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -5012,7 +5012,7 @@ void SemaCodeCompletion::CodeCompleteExpression(
 
   bool PreferredTypeIsPointer = false;
   if (!Data.PreferredType.isNull()) {
-    PreferredTypeIsPointer = Data.PreferredType->isAnyPointerType() ||
+    PreferredTypeIsPointer = Data.PreferredType->isPointerOrObjCObjectPointerType() ||
                              Data.PreferredType->isMemberPointerType() ||
                              Data.PreferredType->isBlockPointerType();
     if (Data.PreferredType->isEnumeralType()) {
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5b7275c316f74a..1dffa174f3c2f9 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -12265,7 +12265,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
         // restricted prior to C++17.
         if (auto *RT = T->getAs<ReferenceType>())
           T = RT->getPointeeType();
-        else if (T->isAnyPointerType())
+        else if (T->isPointerOrObjCObjectPointerType())
           T = T->getPointeeType();
         else if (auto *MPT = T->getAs<MemberPointerType>())
           T = MPT->getPointeeType();
@@ -12499,7 +12499,7 @@ void Sema::CheckMSVCRTEntryPoint(FunctionDecl *FD) {
   // Set an implicit return of 'zero' if the function can return some integral,
   // enumeration, pointer or nullptr type.
   if (FT->getReturnType()->isIntegralOrEnumerationType() ||
-      FT->getReturnType()->isAnyPointerType() ||
+      FT->getReturnType()->isPointerOrObjCObjectPointerType() ||
       FT->getReturnType()->isNullPtrType())
     // DllMain is exempt because a return value of zero means it failed.
     if (FD->getName() != "DllMain")
@@ -16099,7 +16099,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body,
           auto findBeginLoc = [&]() {
             // If the return type has `const` qualifier, we want to insert
             // `static` before `const` (and not before the typename).
-            if ((FD->getReturnType()->isAnyPointerType() &&
+            if ((FD->getReturnType()->isPointerOrObjCObjectPointerType() &&
                  FD->getReturnType()->getPointeeType().isConstQualified()) ||
                 FD->getReturnType().isConstQualified()) {
               // But only do this if we can determine where the `const` is.
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index c1663f2d15c88b..6cf7c585529888 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -206,7 +206,7 @@ static bool threadSafetyCheckIsPointer(Sema &S, const Decl *D,
                                        const ParsedAttr &AL) {
   const auto *VD = cast<ValueDecl>(D);
   QualType QT = VD->getType();
-  if (QT->isAnyPointerType())
+  if (QT->isPointerOrObjCObjectPointerType())
     return true;
 
   if (const auto *RT = QT->getAs<RecordType>()) {
@@ -1267,13 +1267,13 @@ bool Sema::isValidPointerAttrType(QualType T, bool RefOkay) {
       RecordDecl *UD = UT->getDecl();
       for (const auto *I : UD->fields()) {
         QualType QT = I->getType();
-        if (QT->isAnyPointerType() || QT->isBlockPointerType())
+        if (QT->isPointerOrObjCObjectPointerType() || QT->isBlockPointerType())
           return true;
       }
     }
   }
 
-  return T->isAnyPointerType() || T->isBlockPointerType();
+  return T->isPointerOrObjCObjectPointerType() || T->isBlockPointerType();
 }
 
 static bool attrNonNullArgCheck(Sema &S, QualType T, const ParsedAttr &AL,
@@ -1545,7 +1545,7 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
     switch (K) {
       case OwnershipAttr::Takes:
       case OwnershipAttr::Holds:
-        if (!T->isAnyPointerType() && !T->isBlockPointerType())
+        if (!T->isPointerOrObjCObjectPointerType() && !T->isBlockPointerType())
           Err = 0;
         break;
       case OwnershipAttr::Returns:
@@ -1763,7 +1763,7 @@ static void handleTLSModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
 
 static void handleRestrictAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
   QualType ResultType = getFunctionOrMethodResultType(D);
-  if (ResultType->isAnyPointerType() || ResultType->isBlockPointerType()) {
+  if (ResultType->isPointerOrObjCObjectPointerType() || ResultType->isBlockPointerType()) {
     D->addAttr(::new (S.Context) RestrictAttr(S.Context, AL));
     return;
   }
@@ -4129,7 +4129,7 @@ void Sema::AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E) {
   else
     llvm_unreachable("Unknown decl type for align_value");
 
-  if (!T->isDependentType() && !T->isAnyPointerType() &&
+  if (!T->isDependentType() && !T->isPointerOrObjCObjectPointerType() &&
       !T->isReferenceType() && !T->isMemberPointerType()) {
     Diag(AttrLoc, diag::warn_attribute_pointer_or_reference_only)
       << &TmpAttr << T << D->getSourceRange();
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index ae40895980d90a..b1b0061a77c9a4 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -662,7 +662,7 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
   // expressions of certain types in C++.
   if (getLangOpts().CPlusPlus) {
     if (T == Context.OverloadTy || T->isRecordType() ||
-        (T->isDependentType() && !T->isAnyPointerType() &&
+        (T->isDependentType() && !T->isPointerOrObjCObjectPointerType() &&
          !T->isMemberPointerType()))
       return E;
   }
@@ -7974,7 +7974,7 @@ static bool checkCondition(Sema &S, const Expr *Cond,
 /// true otherwise.
 static bool checkConditionalNullPointer(Sema &S, ExprResult &NullExpr,
                                         QualType PointerTy) {
-  if ((!PointerTy->isAnyPointerType() && !PointerTy->isBlockPointerType()) ||
+  if ((!PointerTy->isPointerOrObjCObjectPointerType() && !PointerTy->isBlockPointerType()) ||
       !NullExpr.get()->isNullPointerConstant(S.Context,
                                             Expr::NPC_ValueDependentIsNull))
     return true;
@@ -8725,7 +8725,7 @@ static void DiagnoseConditionalPrecedence(Sema &Self, SourceLocation OpLoc,
 static QualType computeConditionalNullability(QualType ResTy, bool IsBin,
                                               QualType LHSTy, QualType RHSTy,
                                               ASTContext &Ctx) {
-  if (!ResTy->isAnyPointerType())
+  if (!ResTy->isPointerOrObjCObjectPointerType())
     return ResTy;
 
   auto GetNullability = [](QualType Ty) {
@@ -10508,7 +10508,7 @@ static void checkArithmeticNull(Sema &S, ExprResult &LHS, ExprResult &RHS,
 
   // The rest of the operations only make sense with a null pointer
   // if the other expression is a pointer.
-  if (LHSNull == RHSNull || NonNullType->isAnyPointerType() ||
+  if (LHSNull == RHSNull || NonNullType->isPointerOrObjCObjectPointerType() ||
       NonNullType->canDecayToPointerType())
     return;
 
@@ -10709,8 +10709,8 @@ static void diagnoseSubtractionOnNullPointer(Sema &S, SourceLocation Loc,
 /// Diagnose invalid arithmetic on two function pointers.
 static void diagnoseArithmeticOnTwoFunctionPointers(Sema &S, SourceLocation Loc,
                                                     Expr *LHS, Expr *RHS) {
-  assert(LHS->getType()->isAnyPointerType());
-  assert(RHS->getType()->isAnyPointerType());
+  assert(LHS->getType()->isPointerOrObjCObjectPointerType());
+  assert(RHS->getType()->isPointerOrObjCObjectPointerType());
   S.Diag(Loc, S.getLangOpts().CPlusPlus
                 ? diag::err_typecheck_pointer_arith_function_type
                 : diag::ext_gnu_ptr_func_arith)
@@ -10725,7 +10725,7 @@ static void diagnoseArithmeticOnTwoFunctionPointers(Sema &S, SourceLocation Loc,
 /// Diagnose invalid arithmetic on a function pointer.
 static void diagnoseArithmeticOnFunctionPointer(Sema &S, SourceLocation Loc,
                                                 Expr *Pointer) {
-  assert(Pointer->getType()->isAnyPointerType());
+  assert(Pointer->getType()->isPointerOrObjCObjectPointerType());
   S.Diag(Loc, S.getLangOpts().CPlusPlus
                 ? diag::err_typecheck_pointer_arith_function_type
                 : diag::ext_gnu_ptr_func_arith)
@@ -10743,7 +10743,7 @@ static bool checkArithmeticIncompletePointerType(Sema &S, SourceLocation Loc,
   if (const AtomicType *ResAtomicType = ResType->getAs<AtomicType>())
     ResType = ResAtomicType->getValueType();
 
-  assert(ResType->isAnyPointerType());
+  assert(ResType->isPointerOrObjCObjectPointerType());
   QualType PointeeTy = ResType->getPointeeType();
   return S.RequireCompleteSizedType(
       Loc, PointeeTy,
@@ -10765,7 +10765,7 @@ static bool checkArithmeticOpPointerOperand(Sema &S, SourceLocation Loc,
   if (const AtomicType *ResAtomicType = ResType->getAs<AtomicType>())
     ResType = ResAtomicType->getValueType();
 
-  if (!ResType->isAnyPointerType()) return true;
+  if (!ResType->isPointerOrObjCObjectPointerType()) return true;
 
   QualType PointeeTy = ResType->getPointeeType();
   if (PointeeTy->isVoidType()) {
@@ -10793,8 +10793,8 @@ static bool checkArithmeticOpPointerOperand(Sema &S, SourceLocation Loc,
 /// \returns True when the operand is valid to use (even if as an extension).
 static bool checkArithmeticBinOpPointerOperands(Sema &S, SourceLocation Loc,
                                                 Expr *LHSExpr, Expr *RHSExpr) {
-  bool isLHSPointer = LHSExpr->getType()->isAnyPointerType();
-  bool isRHSPointer = RHSExpr->getType()->isAnyPointerType();
+  bool isLHSPointer = LHSExpr->getType()->isPointerOrObjCObjectPointerType();
+  bool isRHSPointer = RHSExpr->getType()->isPointerOrObjCObjectPointerType();
   if (!isLHSPointer && !isRHSPointer) return true;
 
   QualType LHSPointeeTy, RHSPointeeTy;
@@ -10892,7 +10892,7 @@ static void diagnoseStringPlusChar(Sema &Self, SourceLocation OpLoc,
   const QualType StringType = StringRefExpr->getType();
 
   // Return if not a PointerType.
-  if (!StringType->isAnyPointerType())
+  if (!StringType->isPointerOrObjCObjectPointerType())
     return;
 
   // Return if not a CharacterType.
@@ -10928,8 +10928,8 @@ static void diagnoseStringPlusChar(Sema &Self, SourceLocation OpLoc,
 /// Emit error when two pointers are incompatible.
 static void diagnosePointerIncompatibility(Sema &S, SourceLocation Loc,
                                            Expr *LHSExpr, Expr *RHSExpr) {
-  assert(LHSExpr->getType()->isAnyPointerType());
-  assert(RHSExpr->getType()->isAnyPointerType());
+  assert(LHSExpr->getType()->isPointerOrObjCObjectPointerType());
+  assert(RHSExpr->getType()->isPointerOrObjCObjectPointerType());
   S.Diag(Loc, diag::err_typecheck_sub_ptr_compatible)
     << LHSExpr->getType() << RHSExpr->getType() << LHSExpr->getSourceRange()
     << RHSExpr->getSourceRange();
@@ -11007,7 +11007,7 @@ QualType Sema::CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS,
       return InvalidOperands(Loc, LHS, RHS);
     }
   }
-  assert(PExp->getType()->isAnyPointerType());
+  assert(PExp->getType()->isPointerOrObjCObjectPointerType());
 
   if (!IExp->getType()->isIntegerType())
     return InvalidOperands(Loc, LHS, RHS);
@@ -11108,7 +11108,7 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
   }
 
   // Either ptr - int   or   ptr - ptr.
-  if (LHS.get()->getType()->isAnyPointerType()) {
+  if (LHS.get()->getType()->isPointerOrObjCObjectPointerType()) {
     QualType lpointee = LHS.get()->getType()->getPointeeType();
 
     // Diagnose bad cases where we step over interface counts.
@@ -11594,8 +11594,8 @@ static bool convertPointersToCompositeType(Sema &S, SourceLocation Loc,
 
   QualType T = S.FindCompositePointerType(Loc, LHS, RHS);
   if (T.isNull()) {
-    if ((LHSType->isAnyPointerType() || LHSType->isMemberPointerType()) &&
-        (RHSType->isAnyPointerType() || RHSType->isMemberPointerType()))
+    if ((LHSType->isPointerOrObjCObjectPointerType() || LHSType->isMemberPointerType()) &&
+        (RHSType->isPointerOrObjCObjectPointerType() || RHSType->isMemberPointerType()))
       diagnoseDistinctPointerComparison(S, Loc, LHS, RHS, /*isError*/true);
     else
       S.InvalidOperands(Loc, LHS, RHS);
@@ -12165,10 +12165,10 @@ static QualType checkArithmeticOrEnumeralCompare(Sema &S, ExprResult &LHS,
 }
 
 void Sema::CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE) {
-  if (!NullE.get()->getType()->isAnyPointerType())
+  if (!NullE.get()->getType()->isPointerOrObjCObjectPointerType())
     return;
   int NullValue = PP.isMacroDefined("NULL") ? 0 : 1;
-  if (!E.get()->getType()->isAnyPointerType() &&
+  if (!E.get()->getType()->isPointerOrObjCObjectPointerType() &&
       E.get()->isNullPointerConstant(Context,
                                      Expr::NPC_ValueDependentIsNotNull) ==
         Expr::NPCK_ZeroExpression) {
@@ -12605,8 +12605,8 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
       return computeResultTy();
     }
   }
-  if ((LHSType->isAnyPointerType() && RHSType->isIntegerType()) ||
-      (LHSType->isIntegerType() && RHSType->isAnyPointerType())) {
+  if ((LHSType->isPointerOrObjCObjectPointerType() && RHSType->isIntegerType()) ||
+      (LHSType->isIntegerType() && RHSType->isPointerOrObjCObjectPointerType())) {
     unsigned DiagID = 0;
     bool isError = false;
     if (LangOpts.DebuggerSupport) {
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 1e39d69e8b230f..7ba98ed49ebb76 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -5293,7 +5293,7 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
       return false;
     return T->isIncompleteArrayType();
   case UTT_IsPointer:
-    return T->isAnyPointerType();
+    return T->isPointerOrObjCObjectPointerType();
   case UTT_IsLvalueReference:
     return T->isLValueReferenceType();
   case UTT_IsRvalueReference:
@@ -7276,9 +7276,9 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc,
 
   //   where at least one is a pointer or pointer to member type or
   //   std::nullptr_t is:
-  bool T1IsPointerLike = T1->isAnyPointerType() || T1->isMemberPointerType() ||
+  bool T1IsPointerLike = T1->isPointerOrObjCObjectPointerType() || T1->isMemberPointerType() ||
                          T1->isNullPtrType();
-  bool T2IsPointerLike = T2->isAnyPointerType() || T2->isMemberPointerType() ||
+  bool T2IsPointerLike = T2->isPointerOrObjCObjectPointerType() || T2->isMemberPointerType() ||
                          T2->isNullPtrType();
   if (!T1IsPointerLike && !T2IsPointerLike)
     return QualType();
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index e1171d4284c763..7a49bed5500675 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -5481,7 +5481,7 @@ bool FunctionCallFilterCCC::ValidateCandidate(const TypoCorrection &candidate) {
         QualType ValType = cast<ValueDecl>(ND)->getType();
         if (ValType.isNull())
           continue;
-        if (ValType->isAnyPointerType() || ValType->isReferenceType())
+        if (ValType->isPointerOrObjCObjectPointerType() || ValType->isReferenceType())
           ValType = ValType->getPointeeType();
         if (const FunctionProtoType *FPT = ValType->getAs<FunctionProtoType>())
           if (FPT->getNumParams() == NumArgs)
diff --git a/clang/lib/Sema/SemaOpenACC.cpp b/clang/lib/Sema/SemaOpenACC.cpp
index 9ded913638fb3e..47db0d9a089160 100644
--- a/clang/lib/Sema/SemaOpenACC.cpp
+++ b/clang/lib/Sema/SemaOpenACC.cpp
@@ -2635,7 +2635,7 @@ ExprResult SemaOpenACC::ActOnArraySectionExpr(Expr *Base, SourceLocation LBLoc,
   QualType OriginalBaseTy = ArraySectionExpr::getBaseOriginalType(Base);
   QualType ResultTy;
   if (!Base->isTypeDependent()) {
-    if (OriginalBaseTy->isAnyPointerType()) {
+    if (OriginalBaseTy->isPointerOrObjCObjectPointerType()) {
       ResultTy = OriginalBaseTy->getPointeeType();
     } else if (OriginalBaseTy->isArrayType()) {
       ResultTy = OriginalBaseTy->getAsArrayTypeUnsafe()->getElementType();
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index b83b2b12f4a230..3849733973327e 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -2090,7 +2090,7 @@ getVariableCategoryFromDecl(const LangOptions &LO, const ValueDecl *VD) {
       return OMPC_DEFAULTMAP_scalar;
     return OMPC_DEFAULTMAP_aggregate;
   }
-  if (VD->getType().getNonReferenceType()->isAnyPointerType())
+  if (VD->getType().getNonReferenceType()->isPointerOrObjCObjectPointerType())
     return OMPC_DEFAULTMAP_pointer;
   if (VD->getType().getNonReferenceType()->isScalarType())
     return OMPC_DEFAULTMAP_scalar;
@@ -2222,7 +2222,7 @@ bool SemaOpenMP::isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level,
       // (except for reduction variables).
       // Defaultmap scalar is mutual exclusive to defaultmap pointer
       IsByRef = (DSAStack->isForceCaptureByReferenceInTargetExecutable() &&
-                 !Ty->isAnyPointerType()) ||
+                 !Ty->isPointerOrObjCObjectPointerType()) ||
                 !Ty->isScalarType() ||
                 DSAStack->isDefaultmapCapturedByRef(
                     Level, getVariableCategoryFromDecl(getLangOpts(), D)) ||
@@ -8879,7 +8879,7 @@ std::pair<Expr *, Expr *> OpenMPIterationSpaceChecker::buildMinMaxValues(
     return std::make_pair(nullptr, nullptr);
 
   // Convert to the ptrdiff_t, if original type is pointer.
-  if (VarType->isAnyPointerType() &&
+  if (VarType->isPointerOrObjCObjectPointerType() &&
       !SemaRef.Context.hasSameType(
           Diff.get()->getType(),
           SemaRef.Context.getUnsignedPointerDiffType())) {
@@ -17344,7 +17344,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
 
     OpenMPDirectiveKind CurrDir = DSAStack->getCurrentDirective();
     // Variably modified types are not supported for tasks.
-    if (!Type->isAnyPointerType() && Type->isVariablyModifiedType() &&
+    if (!Type->isPointerOrObjCObjectPointerType() && Type->isVariablyModifiedType() &&
         isOpenMPTaskingDirective(CurrDir)) {
       Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
           << getOpenMPClauseName(OMPC_private) << Type
@@ -17619,7 +17619,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
     }
 
     // Variably modified types are not supported for tasks.
-    if (!Type->isAnyPointerType() && Type->isVariablyModifiedType() &&
+    if (!Type->isPointerOrObjCObjectPointerType() && Type->isVariablyModifiedType() &&
         isOpenMPTaskingDirective(DSAStack->getCurrentDirective())) {
       Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
           << getOpenMPClauseName(OMPC_firstprivate) << Type
@@ -19744,7 +19744,7 @@ OMPClause *SemaOpenMP::ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
     }
 
     // Variably modified types are not supported.
-    if (!Type->isAnyPointerType() && Type->isVariablyModifiedType()) {
+    if (!Type->isPointerOrObjCObjectPointerType() && Type->isVariablyModifiedType()) {
       Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
           << getOpenMPClauseName(OMPC_copyprivate) << Type
           << getOpenMPDirectiveName(DSAStack->getCurrentDirective());
@@ -20490,7 +20490,7 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> {
   bool VisitArraySubscriptExpr(ArraySubscriptExpr *AE) {
     Expr *E = AE->getBase()->IgnoreParenImpCasts();
 
-    if (!E->getType()->isAnyPointerType() && !E->getType()->isArrayType()) {
+    if (!E->getType()->isPointerOrObjCObjectPointerType() && !E->getType()->isArrayType()) {
       if (!NoDiagnose) {
         SemaRef.Diag(ELoc, diag::err_omp_expected_base_var_name)
             << 0 << AE->getSourceRange();
@@ -20540,7 +20540,7 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> {
     if (CurType->isReferenceType())
       CurType = CurType->getPointeeType();
 
-    bool IsPointer = CurType->isAnyPointerType();
+    bool IsPointer = CurType->isPointerOrObjCObjectPointerType();
 
     if (!IsPointer && !CurType->isArrayType()) {
       SemaRef.Diag(ELoc, diag::err_omp_expected_base_var_name)
@@ -20814,7 +20814,7 @@ static bool checkMapConflicts(
                          SI->getAssociatedExpression())) {
             Type = OASE->getBase()->getType()->getPointeeType();
           }
-          if (Type.isNull() || Type->isAnyPointerType() ||
+          if (Type.isNull() || Type->isPointerOrObjCObjectPointerType() ||
               checkArrayExpressionDoesNotReferToWholeSize(
                   SemaRef, SI->getAssociatedExpression(), Type))
             break;
@@ -20866,7 +20866,7 @@ static bool checkMapConflicts(
         //  storage in the device data environment, all of the original storage
         //  must have corresponding storage in the device data environment.
         //
-        if (DerivedType->isAnyPointerType()) {
+        if (DerivedType->isPointerOrObjCObjectPointerType()) {
           if (CI == CE || SI == SE) {
             SemaRef.Diag(
                 DerivedLoc,
@@ -20910,7 +20910,7 @@ static bool checkMapConflicts(
               if (It != Begin && It->getAssociatedDeclaration()
                                      ->getType()
                                      .getCanonicalType()
-                                     ->isAnyPointerType()) {
+                                     ->isPointerOrObjCObjectPointerType()) {
                 IsEnclosedByDataEnvironmentExpr = false;
                 EnclosingExpr = nullptr;
                 return false;
@@ -23776,7 +23776,7 @@ ExprResult SemaOpenMP::ActOnOMPArraySectionExpr(
   // Perform default conversions.
   QualType OriginalTy = ArraySectionExpr::getBaseOriginalType(Base);
   QualType ResultTy;
-  if (OriginalTy->isAnyPointerType()) {
+  if (OriginalTy->isPointerOrObjCObjectPointerType()) {
     ResultTy = OriginalTy->getPointeeType();
   } else if (OriginalTy->isArrayType()) {
     ResultTy = OriginalTy->getAsArrayTypeUnsafe()->getElementType();
@@ -23843,7 +23843,7 @@ ExprResult SemaOpenMP::ActOnOMPArraySectionExpr(
                                   diag::err_omp_section_incomplete_type, Base))
     return ExprError();
 
-  if (LowerBound && !OriginalTy->isAnyPointerType()) {
+  if (LowerBound && !OriginalTy->isPointerOrObjCObjectPointerType()) {
     Expr::EvalResult Result;
     if (LowerBound->EvaluateAsInt(Result, Context)) {
       // OpenMP 5.0, [2.1.5 Array Sections]
@@ -24010,7 +24010,7 @@ ExprResult SemaOpenMP::ActOnOMPIteratorExpr(Scope *S,
                              DeclTy->containsUnexpandedParameterPack() ||
                              DeclTy->isInstantiationDependentType();
     if (!IsDeclTyDependent) {
-      if (!DeclTy->isIntegralType(Context) && !DeclTy->isAnyPointerType()) {
+      if (!DeclTy->isIntegralType(Context) && !DeclTy->isPointerOrObjCObjectPointerType()) {
         // OpenMP 5.0, 2.1.6 Iterators, Restrictions, C/C++
         // The iterator-type must be an integral or pointer type.
         Diag(StartLoc, diag::err_omp_iterator_not_integral_or_pointer)
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 34c287926b1d7d..dc944763095d5e 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -301,7 +301,7 @@ isPointerConversionToVoidPointer(ASTContext& Context) const {
   if (First == ICK_Array_To_Pointer)
     FromType = Context.getArrayDecayedType(FromType);
 
-  if (Second == ICK_Pointer_Conversion && FromType->isAnyPointerType())
+  if (Second == ICK_Pointer_Conversion && FromType->isPointerOrObjCObjectPointerType())
     if (const PointerType* ToPtrType = ToType->getAs<PointerType>())
       return ToPtrType->getPointeeType()->isVoidType();
 
@@ -2371,7 +2371,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
     FromType = ToType.getUnqualifiedType();
   } else if (ToType->isBooleanType() &&
              (FromType->isArithmeticType() ||
-              FromType->isAnyPointerType() ||
+              FromType->isPointerOrObjCObjectPointerType() ||
               FromType->isBlockPointerType() ||
               FromType->isMemberPointerType())) {
     // Boolean conversions (C++ 4.12).
@@ -3439,7 +3439,7 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
 
   Kind = CK_BitCast;
 
-  if (Diagnose && !IsCStyleOrFunctionalCast && !FromType->isAnyPointerType() &&
+  if (Diagnose && !IsCStyleOrFunctionalCast && !FromType->isPointerOrObjCObjectPointerType() &&
       From->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNotNull) ==
           Expr::NPCK_ZeroExpression) {
     if (Context.hasSameUnqualifiedType(From->getType(), Context.BoolTy))
@@ -8632,7 +8632,7 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty,
     // the type cannot be restrict-qualified.
     if ((CVR & Qualifiers::Restrict) &&
         (!hasRestrict ||
-         (!(PointeeTy->isAnyPointerType() || PointeeTy->isReferenceType()))))
+         (!(PointeeTy->isPointerOrObjCObjectPointerType() || PointeeTy->isReferenceType()))))
       continue;
 
     // Build qualified pointee type.
@@ -9034,7 +9034,7 @@ class BuiltinOperatorOverloadBuilder {
 
     // Add restrict version only if there are conversions to a restrict type
     // and our candidate type is a non-restrict-qualified pointer.
-    if (HasRestrict && CandidateTy->isAnyPointerType() &&
+    if (HasRestrict && CandidateTy->isPointerOrObjCObjectPointerType() &&
         !CandidateTy.isRestrictQualified()) {
       ParamTypes[0]
         = S.Context.getLValueReferenceType(
diff --git a/clang/lib/Sema/SemaRISCV.cpp b/clang/lib/Sema/SemaRISCV.cpp
index 163f7129a7b42b..9aa0c13c759f82 100644
--- a/clang/lib/Sema/SemaRISCV.cpp
+++ b/clang/lib/Sema/SemaRISCV.cpp
@@ -1339,7 +1339,7 @@ bool SemaRISCV::CheckBuiltinFunctionCall(const TargetInfo &TI,
 
     QualType ValType = PtrType->getPointeeType();
     ValType = ValType.getUnqualifiedType();
-    if (!ValType->isIntegerType() && !ValType->isAnyPointerType() &&
+    if (!ValType->isIntegerType() && !ValType->isPointerOrObjCObjectPointerType() &&
         !ValType->isBlockPointerType() && !ValType->isFloatingType() &&
         !ValType->isVectorType() && !ValType->isRVVSizelessBuiltinType()) {
       Diag(DRE->getBeginLoc(),
diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp
index ce53990fdcb18f..8c7769a1ec05c1 100644
--- a/clang/lib/Sema/SemaSYCL.cpp
+++ b/clang/lib/Sema/SemaSYCL.cpp
@@ -114,7 +114,7 @@ void SemaSYCL::deepTypeCheckForDevice(SourceLocation UsedAt,
 
     // In case pointer/array/reference type is met get pointee type, then
     // proceed with that type.
-    while (NextTy->isAnyPointerType() || NextTy->isArrayType() ||
+    while (NextTy->isPointerOrObjCObjectPointerType() || NextTy->isArrayType() ||
            NextTy->isReferenceType()) {
       if (NextTy->isArrayType())
         NextTy = QualType{NextTy->getArrayElementTypeNoTypeQual(), 0};
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 1c1f6e30ab7b83..d786689d6d853a 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -3795,7 +3795,7 @@ CheckOriginalCallArgDeduction(Sema &S, TemplateDeductionInfo &Info,
   // function types (recursively).
   bool ObjCLifetimeConversion = false;
   QualType ResultTy;
-  if ((A->isAnyPointerType() || A->isMemberPointerType()) &&
+  if ((A->isPointerOrObjCObjectPointerType() || A->isMemberPointerType()) &&
       (S.IsQualificationConversion(A, DeducedA, false,
                                    ObjCLifetimeConversion) ||
        S.IsFunctionConversion(A, DeducedA, ResultTy)))
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 2ccf5a8e1d6f31..a7b386acbc2a5e 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -1595,7 +1595,7 @@ QualType Sema::BuildQualifiedType(QualType T, SourceLocation Loc,
     unsigned DiagID = 0;
     QualType ProblemTy;
 
-    if (T->isAnyPointerType() || T->isReferenceType() ||
+    if (T->isPointerOrObjCObjectPointerType() || T->isReferenceType() ||
         T->isMemberPointerType()) {
       QualType EltTy;
       if (T->isObjCObjectPointerType())
@@ -7365,10 +7365,10 @@ static bool CheckNullabilityTypeSpecifier(
     const Type *pointeeType = nullptr;
     if (Desugared->isArrayType())
       pointeeType = Desugared->getArrayElementTypeNoTypeQual();
-    else if (Desugared->isAnyPointerType())
+    else if (Desugared->isPointerOrObjCObjectPointerType())
       pointeeType = Desugared->getPointeeType().getTypePtr();
 
-    if (pointeeType && (pointeeType->isAnyPointerType() ||
+    if (pointeeType && (pointeeType->isPointerOrObjCObjectPointerType() ||
                         pointeeType->isObjCObjectPointerType() ||
                         pointeeType->isMemberPointerType())) {
       S.Diag(NullabilityLoc, diag::err_nullability_cs_multilevel)
@@ -9807,7 +9807,7 @@ QualType Sema::BuiltinAddPointer(QualType BaseType, SourceLocation Loc) {
 
 QualType Sema::BuiltinRemovePointer(QualType BaseType, SourceLocation Loc) {
   // We don't want block pointers or ObjectiveC's id type.
-  if (!BaseType->isAnyPointerType() || BaseType->isObjCIdType())
+  if (!BaseType->isPointerOrObjCObjectPointerType() || BaseType->isObjCIdType())
     return BaseType;
 
   return BaseType->getPointeeType();
diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index 1a14f38e34f0e1..73eeac8789ba78 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -2649,7 +2649,7 @@ void CStringChecker::evalSprintfCommon(CheckerContext &C, const CallEvent &Call,
   for (const auto &[ArgIdx, ArgExpr] : VariadicArguments) {
     // We consider only string buffers
     if (const QualType type = ArgExpr->getType();
-        !type->isAnyPointerType() ||
+        !type->isPointerOrObjCObjectPointerType() ||
         !type->getPointeeType()->isAnyCharacterType())
       continue;
     SourceArgExpr Source = {{ArgExpr, unsigned(ArgIdx)}};
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
index c8fe5c2ccf384e..863358d2609545 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
@@ -30,7 +30,7 @@ static bool AreTypesCompatible(QualType Derived, QualType Ancestor,
 
   // Right now don't compare the compatibility of pointers.  That involves
   // looking at subtyping relationships.  FIXME: Future patch.
-  if (Derived->isAnyPointerType() &&  Ancestor->isAnyPointerType())
+  if (Derived->isPointerOrObjCObjectPointerType() &&  Ancestor->isPointerOrObjCObjectPointerType())
     return true;
 
   return C.typesAreCompatible(Derived, Ancestor);
diff --git a/clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
index 079bc61a87d963..171fb601ea80db 100644
--- a/clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
@@ -274,7 +274,7 @@ class FuchsiaHandleSymbolVisitor final : public SymbolVisitor {
 static SmallVector<SymbolRef, 1024>
 getFuchsiaHandleSymbols(QualType QT, SVal Arg, ProgramStateRef State) {
   int PtrToHandleLevel = 0;
-  while (QT->isAnyPointerType() || QT->isReferenceType()) {
+  while (QT->isPointerOrObjCObjectPointerType() || QT->isReferenceType()) {
     ++PtrToHandleLevel;
     QT = QT->getPointeeType();
   }
diff --git a/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
index 04472bb3895a78..a3d27e13f4d702 100644
--- a/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -311,7 +311,7 @@ static NullConstraint getNullConstraint(DefinedOrUnknownSVal Val,
 }
 
 static bool isValidPointerType(QualType T) {
-  return T->isAnyPointerType() || T->isBlockPointerType();
+  return T->isPointerOrObjCObjectPointerType() || T->isBlockPointerType();
 }
 
 const SymbolicRegion *
diff --git a/clang/lib/StaticAnalyzer/Checkers/TrustNonnullChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/TrustNonnullChecker.cpp
index e2f8bd541c9670..25c6eadb912649 100644
--- a/clang/lib/StaticAnalyzer/Checkers/TrustNonnullChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/TrustNonnullChecker.cpp
@@ -155,7 +155,7 @@ class TrustNonnullChecker : public Checker<check::PostCall,
   /// a non-null pointer.
   bool isNonNullPtr(const CallEvent &Call, CheckerContext &C) const {
     QualType ExprRetType = Call.getResultType();
-    if (!ExprRetType->isAnyPointerType())
+    if (!ExprRetType->isPointerOrObjCObjectPointerType())
       return false;
 
     if (getNullabilityAnnotation(ExprRetType) == Nullability::Nonnull)
diff --git a/clang/lib/StaticAnalyzer/Checkers/TrustReturnsNonnullChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/TrustReturnsNonnullChecker.cpp
index d80559c6a91522..0a0a22e2fdbca9 100644
--- a/clang/lib/StaticAnalyzer/Checkers/TrustReturnsNonnullChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/TrustReturnsNonnullChecker.cpp
@@ -42,7 +42,7 @@ class TrustReturnsNonnullChecker : public Checker<check::PostCall> {
   bool isNonNullPtr(const CallEvent &Call) const {
     QualType ExprRetType = Call.getResultType();
     const Decl *CallDeclaration =  Call.getDecl();
-    if (!ExprRetType->isAnyPointerType() || !CallDeclaration)
+    if (!ExprRetType->isPointerOrObjCObjectPointerType() || !CallDeclaration)
       return false;
 
     return CallDeclaration->hasAttr<ReturnsNonNullAttr>();
diff --git a/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h b/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
index e35778e6480c5b..fae816bf7240f6 100644
--- a/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
+++ b/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
@@ -328,7 +328,7 @@ inline bool isPrimitiveType(const QualType &T) {
 }
 
 inline bool isDereferencableType(const QualType &T) {
-  return T->isAnyPointerType() || T->isReferenceType();
+  return T->isPointerOrObjCObjectPointerType() || T->isReferenceType();
 }
 
 // Template method definitions.
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index a9b4dbb39b5bd6..41e7ff797c91dd 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -767,7 +767,7 @@ bool NoStoreFuncVisitor::prettyPrintRegionName(const RegionVector &FieldChain,
       return false;
 
     const auto *DR = cast<DeclRegion>(R);
-    Sep = DR->getValueType()->isAnyPointerType() ? "->" : ".";
+    Sep = DR->getValueType()->isPointerOrObjCObjectPointerType() ? "->" : ".";
     DR->getDecl()->getDeclName().print(os, PP);
   }
 
@@ -3337,7 +3337,7 @@ UndefOrNullArgVisitor::VisitNode(const ExplodedNode *N, BugReporterContext &BRC,
     assert(ParamDecl && "Formal parameter has no decl?");
     QualType T = ParamDecl->getType();
 
-    if (!(T->isAnyPointerType() || T->isReferenceType())) {
+    if (!(T->isPointerOrObjCObjectPointerType() || T->isReferenceType())) {
       // Function can only change the value passed in by address.
       continue;
     }
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
index bb4a39f68280cd..db0dc968ae24f0 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -87,7 +87,7 @@ static bool isCallback(QualType T) {
   // Check if a callback is passed inside a struct (for both, struct passed by
   // reference and by value). Dig just one level into the struct for now.
 
-  if (T->isAnyPointerType() || T->isReferenceType())
+  if (T->isPointerOrObjCObjectPointerType() || T->isReferenceType())
     T = T->getPointeeType();
 
   if (const RecordType *RT = T->getAsStructureType()) {
@@ -212,7 +212,7 @@ static bool isPointerToConst(QualType Ty) {
     return false;
   if (!PointeeTy.isConstQualified())
     return false;
-  if (PointeeTy->isAnyPointerType())
+  if (PointeeTy->isPointerOrObjCObjectPointerType())
     return false;
   return true;
 }
diff --git a/clang/lib/StaticAnalyzer/Core/DynamicType.cpp b/clang/lib/StaticAnalyzer/Core/DynamicType.cpp
index 06052cb99fd18d..480c65217a564b 100644
--- a/clang/lib/StaticAnalyzer/Core/DynamicType.cpp
+++ b/clang/lib/StaticAnalyzer/Core/DynamicType.cpp
@@ -117,7 +117,7 @@ ProgramStateRef setDynamicTypeAndCastInfo(ProgramStateRef State,
     return State;
 
   if (CastSucceeds) {
-    assert((CastToTy->isAnyPointerType() || CastToTy->isReferenceType()) &&
+    assert((CastToTy->isPointerOrObjCObjectPointerType() || CastToTy->isReferenceType()) &&
            "DynamicTypeInfo should always be a pointer.");
     State = State->set<DynamicTypeMap>(MR, CastToTy);
   }
@@ -206,7 +206,7 @@ static raw_ostream &printJson(const DynamicTypeInfo &DTI, raw_ostream &Out,
     Out << "null";
   } else {
     QualType ToPrint = DTI.getType();
-    if (ToPrint->isAnyPointerType())
+    if (ToPrint->isPointerOrObjCObjectPointerType())
       ToPrint = ToPrint->getPointeeType();
 
     Out << '\"' << ToPrint << "\", \"sub_classable\": "
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
index 7a900780384a91..56f1d88173df2c 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
@@ -1101,7 +1101,7 @@ void ExprEngine::VisitIncrementDecrementOperator(const UnaryOperator* U,
     SVal RHS;
     SVal Result;
 
-    if (U->getType()->isAnyPointerType())
+    if (U->getType()->isPointerOrObjCObjectPointerType())
       RHS = svalBuilder.makeArrayIndex(1);
     else if (U->getType()->isIntegralOrEnumerationType())
       RHS = svalBuilder.makeIntVal(1, U->getType());
diff --git a/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp b/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
index afb0273d23bd45..67c277c2b673ee 100644
--- a/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ b/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -1179,7 +1179,7 @@ SVal SimpleSValBuilder::evalBinOpLN(ProgramStateRef state,
       // hierarchy to provide typed regions for all non-void pointers would be
       // better. For instance, we cannot extend this towards LocAsInteger
       // operations, where result type of the expression is integer.
-      if (resultTy->isAnyPointerType())
+      if (resultTy->isPointerOrObjCObjectPointerType())
         elementType = resultTy->getPointeeType();
     }
 
diff --git a/clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp b/clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp
index 10588a383da0be..4bf4d69f5f9109 100644
--- a/clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp
+++ b/clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp
@@ -220,7 +220,7 @@ std::optional<std::string> tooling::buildAccess(const Expr &RawExpression,
 
   const Expr *E = RawExpression.IgnoreImplicitAsWritten();
 
-  if (E->getType()->isAnyPointerType() ||
+  if (E->getType()->isPointerOrObjCObjectPointerType() ||
       treatLikePointer(E->getType(), Classification, Context)) {
     // Strip off operator-> calls. They can only occur inside an actual arrow
     // member access, so we treat them as equivalent to an actual object
diff --git a/clang/lib/Tooling/Transformer/Stencil.cpp b/clang/lib/Tooling/Transformer/Stencil.cpp
index c39a71b5983fc3..db512494e67c88 100644
--- a/clang/lib/Tooling/Transformer/Stencil.cpp
+++ b/clang/lib/Tooling/Transformer/Stencil.cpp
@@ -166,7 +166,7 @@ class UnaryOperationStencil : public StencilInterface {
       Source = tooling::buildDereference(*E, *Match.Context);
       break;
     case UnaryNodeOperator::MaybeDeref:
-      if (E->getType()->isAnyPointerType() ||
+      if (E->getType()->isPointerOrObjCObjectPointerType() ||
           tooling::isKnownPointerLikeType(E->getType(), *Match.Context)) {
         // Strip off any operator->. This can only occur inside an actual arrow
         // member access, so we treat it as equivalent to an actual object
@@ -186,7 +186,7 @@ class UnaryOperationStencil : public StencilInterface {
       Source = tooling::buildAddressOf(*E, *Match.Context);
       break;
     case UnaryNodeOperator::MaybeAddressOf:
-      if (E->getType()->isAnyPointerType() ||
+      if (E->getType()->isPointerOrObjCObjectPointerType() ||
           tooling::isKnownPointerLikeType(E->getType(), *Match.Context)) {
         // Strip off any operator->. This can only occur inside an actual arrow
         // member access, so we treat it as equivalent to an actual object
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 47051f2e68090f..a49b3eea4ec82b 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4048,7 +4048,7 @@ TypeSystemClang::GetMinimumLanguage(lldb::opaque_compiler_type_t type) {
 
   // If the type is a reference, then resolve it to what it refers to first:
   clang::QualType qual_type(GetCanonicalQualType(type).getNonReferenceType());
-  if (qual_type->isAnyPointerType()) {
+  if (qual_type->isPointerOrObjCObjectPointerType()) {
     if (qual_type->isObjCObjectPointerType())
       return lldb::eLanguageTypeObjC;
     if (qual_type->getPointeeCXXRecordDecl())

>From 1c26eb363147bd10be797d3d77603fb793b2bc0f Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Mon, 13 Jan 2025 21:30:48 +0100
Subject: [PATCH 2/5] clang-format

---
 .../readability/IdentifierNamingCheck.cpp     | 15 ++++++---
 .../SuspiciousCallArgumentCheck.cpp           |  3 +-
 clang/include/clang/AST/Type.h                |  7 +++--
 .../Core/PathSensitive/SMTConv.h              | 17 ++++++----
 clang/lib/AST/ASTContext.cpp                  |  4 +--
 clang/lib/AST/MicrosoftMangle.cpp             |  5 +--
 clang/lib/Analysis/UninitializedValues.cpp    |  3 +-
 clang/lib/CodeGen/CGCall.cpp                  |  3 +-
 clang/lib/CodeGen/CGOpenMPRuntime.cpp         | 19 +++++++-----
 clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp      |  4 ++-
 clang/lib/CodeGen/CGStmtOpenMP.cpp            |  6 ++--
 clang/lib/CodeGen/CodeGenTypes.cpp            |  3 +-
 clang/lib/Frontend/ASTUnit.cpp                |  6 ++--
 clang/lib/Sema/SemaAPINotes.cpp               |  4 +--
 clang/lib/Sema/SemaARM.cpp                    |  6 ++--
 clang/lib/Sema/SemaCast.cpp                   | 31 ++++++++++++-------
 clang/lib/Sema/SemaChecking.cpp               |  6 ++--
 clang/lib/Sema/SemaCodeComplete.cpp           |  7 +++--
 clang/lib/Sema/SemaDeclAttr.cpp               |  3 +-
 clang/lib/Sema/SemaExpr.cpp                   | 22 ++++++++-----
 clang/lib/Sema/SemaExprCXX.cpp                |  8 ++---
 clang/lib/Sema/SemaLookup.cpp                 |  3 +-
 clang/lib/Sema/SemaOpenMP.cpp                 | 16 ++++++----
 clang/lib/Sema/SemaOverload.cpp               | 11 ++++---
 clang/lib/Sema/SemaRISCV.cpp                  |  3 +-
 clang/lib/Sema/SemaSYCL.cpp                   |  4 +--
 .../Checkers/CheckObjCInstMethSignature.cpp   |  3 +-
 clang/lib/StaticAnalyzer/Core/DynamicType.cpp |  3 +-
 28 files changed, 138 insertions(+), 87 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
index 27031c2d6aeb25..dc740377c4db14 100644
--- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -1232,7 +1232,8 @@ StyleKind IdentifierNamingCheck::findStyleKind(
     if (Decl->isParameterPack() && NamingStyles[SK_ParameterPack])
       return SK_ParameterPack;
 
-    if (!Type.isNull() && Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
+    if (!Type.isNull() &&
+        Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
         NamingStyles[SK_PointerParameter])
       return SK_PointerParameter;
 
@@ -1508,7 +1509,8 @@ StyleKind IdentifierNamingCheck::findStyleKindForVar(
     if (Var->isStaticDataMember() && NamingStyles[SK_ClassConstant])
       return SK_ClassConstant;
 
-    if (Var->isFileVarDecl() && Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
+    if (Var->isFileVarDecl() &&
+        Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
         NamingStyles[SK_GlobalConstantPointer])
       return SK_GlobalConstantPointer;
 
@@ -1518,7 +1520,8 @@ StyleKind IdentifierNamingCheck::findStyleKindForVar(
     if (Var->isStaticLocal() && NamingStyles[SK_StaticConstant])
       return SK_StaticConstant;
 
-    if (Var->isLocalVarDecl() && Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
+    if (Var->isLocalVarDecl() &&
+        Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
         NamingStyles[SK_LocalConstantPointer])
       return SK_LocalConstantPointer;
 
@@ -1535,7 +1538,8 @@ StyleKind IdentifierNamingCheck::findStyleKindForVar(
   if (Var->isStaticDataMember() && NamingStyles[SK_ClassMember])
     return SK_ClassMember;
 
-  if (Var->isFileVarDecl() && Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
+  if (Var->isFileVarDecl() &&
+      Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
       NamingStyles[SK_GlobalPointer])
     return SK_GlobalPointer;
 
@@ -1545,7 +1549,8 @@ StyleKind IdentifierNamingCheck::findStyleKindForVar(
   if (Var->isStaticLocal() && NamingStyles[SK_StaticVariable])
     return SK_StaticVariable;
 
-  if (Var->isLocalVarDecl() && Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
+  if (Var->isLocalVarDecl() &&
+      Type.getTypePtr()->isPointerOrObjCObjectPointerType() &&
       NamingStyles[SK_LocalPointer])
     return SK_LocalPointer;
 
diff --git a/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp b/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
index 108c8d2e0a29ff..dc6b459e05bdfb 100644
--- a/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp
@@ -472,7 +472,8 @@ static bool areTypesCompatible(QualType ArgType, QualType ParamType,
 
   // Unless argument and param are both multilevel pointers, the types are not
   // convertible.
-  if (!(ParamType->isPointerOrObjCObjectPointerType() && ArgType->isPointerOrObjCObjectPointerType()))
+  if (!(ParamType->isPointerOrObjCObjectPointerType() &&
+        ArgType->isPointerOrObjCObjectPointerType()))
     return false;
 
   return arePointerTypesCompatible(ArgType, ParamType, IsParamContinuouslyConst,
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index fed1647da43534..437343788227bc 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2536,7 +2536,8 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
   bool isPointerType() const;
   bool isPointerOrReferenceType() const;
   bool isSignableType() const;
-  bool isPointerOrObjCObjectPointerType() const;   // Any C pointer or ObjC object pointer
+  bool isPointerOrObjCObjectPointerType()
+      const; // Any C pointer or ObjC object pointer
   bool isCountAttributedType() const;
   bool isBlockPointerType() const;
   bool isVoidPointerType() const;
@@ -8656,8 +8657,8 @@ inline bool Type::isUndeducedType() const {
 inline bool Type::isOverloadableType() const {
   if (!isDependentType())
     return isRecordType() || isEnumeralType();
-  return !isArrayType() && !isFunctionType() && !isPointerOrObjCObjectPointerType() &&
-         !isMemberPointerType();
+  return !isArrayType() && !isFunctionType() &&
+         !isPointerOrObjCObjectPointerType() && !isMemberPointerType();
 }
 
 /// Determines whether this type is written as a typedef-name.
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h
index ef5bf4b50371db..d175b6d2886095 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h
@@ -264,7 +264,8 @@ class SMTConv {
                                           uint64_t FromBitWidth) {
     if ((FromTy->isIntegralOrEnumerationType() &&
          ToTy->isIntegralOrEnumerationType()) ||
-        (FromTy->isPointerOrObjCObjectPointerType() ^ ToTy->isPointerOrObjCObjectPointerType()) ||
+        (FromTy->isPointerOrObjCObjectPointerType() ^
+         ToTy->isPointerOrObjCObjectPointerType()) ||
         (FromTy->isBlockPointerType() ^ ToTy->isBlockPointerType()) ||
         (FromTy->isReferenceType() ^ ToTy->isReferenceType())) {
 
@@ -365,7 +366,8 @@ class SMTConv {
 
       // If the two operands are pointers and the operation is a subtraction,
       // the result is of type ptrdiff_t, which is signed
-      if (LTy->isPointerOrObjCObjectPointerType() && RTy->isPointerOrObjCObjectPointerType() && Op == BO_Sub) {
+      if (LTy->isPointerOrObjCObjectPointerType() &&
+          RTy->isPointerOrObjCObjectPointerType() && Op == BO_Sub) {
         *RetTy = Ctx.getPointerDiffType();
       }
     }
@@ -509,8 +511,9 @@ class SMTConv {
                             Solver->mkFloat(Zero));
     }
 
-    if (Ty->isIntegralOrEnumerationType() || Ty->isPointerOrObjCObjectPointerType() ||
-        Ty->isBlockPointerType() || Ty->isReferenceType()) {
+    if (Ty->isIntegralOrEnumerationType() ||
+        Ty->isPointerOrObjCObjectPointerType() || Ty->isBlockPointerType() ||
+        Ty->isReferenceType()) {
 
       // Skip explicit comparison for boolean types
       bool isSigned = Ty->isSignedIntegerOrEnumerationType();
@@ -613,7 +616,8 @@ class SMTConv {
       return;
     }
 
-    if ((LTy->isPointerOrObjCObjectPointerType() || RTy->isPointerOrObjCObjectPointerType()) ||
+    if ((LTy->isPointerOrObjCObjectPointerType() ||
+         RTy->isPointerOrObjCObjectPointerType()) ||
         (LTy->isBlockPointerType() || RTy->isBlockPointerType()) ||
         (LTy->isReferenceType() || RTy->isReferenceType())) {
       // TODO: Refactor to Sema::FindCompositePointerType(), and
@@ -624,7 +628,8 @@ class SMTConv {
 
       // Cast the non-pointer type to the pointer type.
       // TODO: Be more strict about this.
-      if ((LTy->isPointerOrObjCObjectPointerType() ^ RTy->isPointerOrObjCObjectPointerType()) ||
+      if ((LTy->isPointerOrObjCObjectPointerType() ^
+           RTy->isPointerOrObjCObjectPointerType()) ||
           (LTy->isBlockPointerType() ^ RTy->isBlockPointerType()) ||
           (LTy->isReferenceType() ^ RTy->isReferenceType())) {
         if (LTy->isNullPtrType() || LTy->isBlockPointerType() ||
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index d6fdb035294068..9d4743bd0a0aa7 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -2981,8 +2981,8 @@ bool ASTContext::isSentinelNullExpr(const Expr *E) {
   if (E->getType()->isNullPtrType()) return true;
 
   if (E->getType()->isPointerOrObjCObjectPointerType() &&
-      E->IgnoreParenCasts()->isNullPointerConstant(*this,
-                                                Expr::NPC_ValueDependentIsNull))
+      E->IgnoreParenCasts()->isNullPointerConstant(
+          *this, Expr::NPC_ValueDependentIsNull))
     return true;
 
   // Unfortunately, __null has type 'int'.
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp
index 63a1a53c4e74a1..ce8ca88b7f4258 100644
--- a/clang/lib/AST/MicrosoftMangle.cpp
+++ b/clang/lib/AST/MicrosoftMangle.cpp
@@ -2570,8 +2570,9 @@ void MicrosoftCXXNameMangler::mangleType(QualType T, SourceRange Range,
     return;
   }
 
-  bool IsPointer = T->isPointerOrObjCObjectPointerType() || T->isMemberPointerType() ||
-                   T->isReferenceType() || T->isBlockPointerType();
+  bool IsPointer = T->isPointerOrObjCObjectPointerType() ||
+                   T->isMemberPointerType() || T->isReferenceType() ||
+                   T->isBlockPointerType();
 
   switch (QMM) {
   case QMM_Drop:
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp
index ad6870f49dd993..9cce3c0961cbed 100644
--- a/clang/lib/Analysis/UninitializedValues.cpp
+++ b/clang/lib/Analysis/UninitializedValues.cpp
@@ -417,7 +417,8 @@ void ClassifyRefs::VisitOMPExecutableDirective(OMPExecutableDirective *ED) {
 }
 
 static bool isPointerToConst(const QualType &QT) {
-  return QT->isPointerOrObjCObjectPointerType() && QT->getPointeeType().isConstQualified();
+  return QT->isPointerOrObjCObjectPointerType() &&
+         QT->getPointeeType().isConstQualified();
 }
 
 static bool hasTrivialBody(CallExpr *CE) {
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 4840f1af5c201f..3bdb0216ce28cf 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2929,7 +2929,8 @@ static const NonNullAttr *getNonNullAttr(const Decl *FD, const ParmVarDecl *PVD,
   // In the former case, LLVM IR cannot represent the constraint. In
   // the latter case, we have no guarantee that the transparent union
   // is in fact passed as a pointer.
-  if (!ArgType->isPointerOrObjCObjectPointerType() && !ArgType->isBlockPointerType())
+  if (!ArgType->isPointerOrObjCObjectPointerType() &&
+      !ArgType->isBlockPointerType())
     return nullptr;
   // First, check attribute on parameter itself.
   if (PVD) {
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index f61c2f9d32861c..ba42f1e39889ae 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -7188,12 +7188,13 @@ class MappableExprsHandler {
           dyn_cast<OMPArrayShapingExpr>(I->getAssociatedExpression());
       const auto *UO = dyn_cast<UnaryOperator>(I->getAssociatedExpression());
       const auto *BO = dyn_cast<BinaryOperator>(I->getAssociatedExpression());
-      bool IsPointer =
-          OAShE ||
-          (OASE && ArraySectionExpr::getBaseOriginalType(OASE)
-                       .getCanonicalType()
-                       ->isPointerOrObjCObjectPointerType()) ||
-          I->getAssociatedExpression()->getType()->isPointerOrObjCObjectPointerType();
+      bool IsPointer = OAShE ||
+                       (OASE && ArraySectionExpr::getBaseOriginalType(OASE)
+                                    .getCanonicalType()
+                                    ->isPointerOrObjCObjectPointerType()) ||
+                       I->getAssociatedExpression()
+                           ->getType()
+                           ->isPointerOrObjCObjectPointerType();
       bool IsMemberReference = isa<MemberExpr>(I->getAssociatedExpression()) &&
                                MapDecl &&
                                MapDecl->getType()->isLValueReferenceType();
@@ -8533,7 +8534,8 @@ class MappableExprsHandler {
         assert(VDecl == VD && "We got information for the wrong declaration??");
         assert(!Components.empty() &&
                "Not expecting declaration with no component lists.");
-        if (VD && E && VD->getType()->isPointerOrObjCObjectPointerType() && isa<DeclRefExpr>(E))
+        if (VD && E && VD->getType()->isPointerOrObjCObjectPointerType() &&
+            isa<DeclRefExpr>(E))
           HasMapBasePtr = true;
         if (VD && E && VD->getType()->isPointerOrObjCObjectPointerType() &&
             (isa<ArraySectionExpr>(E) || isa<ArraySubscriptExpr>(E)))
@@ -8784,7 +8786,8 @@ class MappableExprsHandler {
       CombinedInfo.BasePointers.push_back(CV);
       CombinedInfo.DevicePtrDecls.push_back(nullptr);
       CombinedInfo.DevicePointers.push_back(DeviceInfoTy::None);
-      if (I != FirstPrivateDecls.end() && ElementType->isPointerOrObjCObjectPointerType()) {
+      if (I != FirstPrivateDecls.end() &&
+          ElementType->isPointerOrObjCObjectPointerType()) {
         Address PtrAddr = CGF.EmitLoadOfReference(CGF.MakeAddrLValue(
             CV, ElementType, CGF.getContext().getDeclAlign(VD),
             AlignmentSource::Decl));
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index 23389a45e2639a..127d0d73f22d0c 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -1962,7 +1962,9 @@ llvm::Function *CGOpenMPRuntimeGPU::createParallelDataSharingWrapper(
                                               CGFContext.getPointerType(ElemTy),
                                               CI->getLocation());
       if (CI->capturesVariableByCopy() &&
-          !CI->getCapturedVar()->getType()->isPointerOrObjCObjectPointerType()) {
+          !CI->getCapturedVar()
+               ->getType()
+               ->isPointerOrObjCObjectPointerType()) {
         Arg = castValueToType(CGF, Arg, ElemTy, CGFContext.getUIntPtrType(),
                               CI->getLocation());
       }
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index d21ef3acd6b380..04f16cfaceead3 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -520,7 +520,8 @@ static llvm::Function *emitOutlinedFunctionPrologue(
     // deal with pointers. We can pass in the same way the VLA type sizes to the
     // outlined function.
     if (FO.UIntPtrCastRequired &&
-        ((I->capturesVariableByCopy() && !ArgType->isPointerOrObjCObjectPointerType()) ||
+        ((I->capturesVariableByCopy() &&
+          !ArgType->isPointerOrObjCObjectPointerType()) ||
          I->capturesVariableArrayType()))
       ArgType = Ctx.getUIntPtrType();
 
@@ -601,7 +602,8 @@ static llvm::Function *emitOutlinedFunctionPrologue(
     }
     // If we are capturing a pointer by copy we don't need to do anything, just
     // use the value that we get from the arguments.
-    if (I->capturesVariableByCopy() && FD->getType()->isPointerOrObjCObjectPointerType()) {
+    if (I->capturesVariableByCopy() &&
+        FD->getType()->isPointerOrObjCObjectPointerType()) {
       const VarDecl *CurVD = I->getCapturedVar();
       if (!FO.RegisterCastedArgsOnly)
         LocalAddrs.insert({Args[Cnt], {CurVD, LocalAddr}});
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index 90deed4d48db7e..742c7b2bfc7803 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -832,7 +832,8 @@ CodeGenTypes::getCGRecordLayout(const RecordDecl *RD) {
 }
 
 bool CodeGenTypes::isPointerZeroInitializable(QualType T) {
-  assert((T->isPointerOrObjCObjectPointerType() || T->isBlockPointerType()) && "Invalid type");
+  assert((T->isPointerOrObjCObjectPointerType() || T->isBlockPointerType()) &&
+         "Invalid type");
   return isZeroInitializable(T);
 }
 
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 5aa578c8876e3a..819b096c431f4b 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -2135,9 +2135,9 @@ void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S,
     CodeCompletionString *Completion = C->Completion;
     if (!Context.getPreferredType().isNull()) {
       if (C->Kind == CXCursor_MacroDefinition) {
-        Priority = getMacroUsagePriority(C->Completion->getTypedText(),
-                                         S.getLangOpts(),
-                               Context.getPreferredType()->isPointerOrObjCObjectPointerType());
+        Priority = getMacroUsagePriority(
+            C->Completion->getTypedText(), S.getLangOpts(),
+            Context.getPreferredType()->isPointerOrObjCObjectPointerType());
       } else if (C->Type) {
         CanQualType Expected
           = S.Context.getCanonicalType(
diff --git a/clang/lib/Sema/SemaAPINotes.cpp b/clang/lib/Sema/SemaAPINotes.cpp
index 5cbee667924cd5..c9c4717ca9d17a 100644
--- a/clang/lib/Sema/SemaAPINotes.cpp
+++ b/clang/lib/Sema/SemaAPINotes.cpp
@@ -48,8 +48,8 @@ static bool isIndirectPointerType(QualType Type) {
   if (Pointee.isNull())
     return false;
 
-  return Pointee->isPointerOrObjCObjectPointerType() || Pointee->isObjCObjectPointerType() ||
-         Pointee->isMemberPointerType();
+  return Pointee->isPointerOrObjCObjectPointerType() ||
+         Pointee->isObjCObjectPointerType() || Pointee->isMemberPointerType();
 }
 
 /// Apply nullability to the given declaration.
diff --git a/clang/lib/Sema/SemaARM.cpp b/clang/lib/Sema/SemaARM.cpp
index 82d5e33a7e8078..f8df8b36c62d14 100644
--- a/clang/lib/Sema/SemaARM.cpp
+++ b/clang/lib/Sema/SemaARM.cpp
@@ -162,7 +162,8 @@ bool SemaARM::BuiltinARMMemoryTaggingCall(unsigned BuiltinID,
     }
 
     // at least one argument should be pointer type
-    if (!ArgTypeA->isPointerOrObjCObjectPointerType() && !ArgTypeB->isPointerOrObjCObjectPointerType())
+    if (!ArgTypeA->isPointerOrObjCObjectPointerType() &&
+        !ArgTypeB->isPointerOrObjCObjectPointerType())
       return Diag(TheCall->getBeginLoc(), diag::err_memtag_any2arg_pointer)
              << ArgTypeA << ArgTypeB << ArgA->getSourceRange();
 
@@ -924,7 +925,8 @@ bool SemaARM::CheckARMBuiltinExclusiveCall(unsigned BuiltinID,
   TheCall->setArg(IsLdrex ? 0 : 1, PointerArg);
 
   // In general, we allow ints, floats and pointers to be loaded and stored.
-  if (!ValType->isIntegerType() && !ValType->isPointerOrObjCObjectPointerType() &&
+  if (!ValType->isIntegerType() &&
+      !ValType->isPointerOrObjCObjectPointerType() &&
       !ValType->isBlockPointerType() && !ValType->isFloatingType()) {
     Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intfltptr)
         << PointerArg->getType() << 0 << PointerArg->getSourceRange();
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index bcc777ec62bc3b..479337df148ff6 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -596,12 +596,16 @@ static CastAwayConstnessKind
 unwrapCastAwayConstnessLevel(ASTContext &Context, QualType &T1, QualType &T2) {
   enum { None, Ptr, MemPtr, BlockPtr, Array };
   auto Classify = [](QualType T) {
-    if (T->isPointerOrObjCObjectPointerType()) return Ptr;
-    if (T->isMemberPointerType()) return MemPtr;
-    if (T->isBlockPointerType()) return BlockPtr;
+    if (T->isPointerOrObjCObjectPointerType())
+      return Ptr;
+    if (T->isMemberPointerType())
+      return MemPtr;
+    if (T->isBlockPointerType())
+      return BlockPtr;
     // We somewhat-arbitrarily don't look through VLA types here. This is at
     // least consistent with the behavior of UnwrapSimilarTypes.
-    if (T->isConstantArrayType() || T->isIncompleteArrayType()) return Array;
+    if (T->isConstantArrayType() || T->isIncompleteArrayType())
+      return Array;
     return None;
   };
 
@@ -682,10 +686,11 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType,
     return CastAwayConstnessKind::CACK_None;
 
   if (!DestType->isReferenceType()) {
-    assert((SrcType->isPointerOrObjCObjectPointerType() || SrcType->isMemberPointerType() ||
-            SrcType->isBlockPointerType()) &&
+    assert((SrcType->isPointerOrObjCObjectPointerType() ||
+            SrcType->isMemberPointerType() || SrcType->isBlockPointerType()) &&
            "Source type is not pointer or pointer to member.");
-    assert((DestType->isPointerOrObjCObjectPointerType() || DestType->isMemberPointerType() ||
+    assert((DestType->isPointerOrObjCObjectPointerType() ||
+            DestType->isMemberPointerType() ||
             DestType->isBlockPointerType()) &&
            "Destination type is not pointer or pointer to member.");
   }
@@ -2451,8 +2456,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
     TryCastResult Result = TC_NotApplicable;
     if (SrcType->isIntegralOrEnumerationType() ||
         SrcType->isPointerOrObjCObjectPointerType() ||
-        SrcType->isMemberPointerType() ||
-        SrcType->isBlockPointerType()) {
+        SrcType->isMemberPointerType() || SrcType->isBlockPointerType()) {
       Result = TC_Success;
     }
     return Result;
@@ -2902,8 +2906,10 @@ static void DiagnoseBadFunctionCast(Sema &Self, const ExprResult &SrcExpr,
   QualType SrcType = SrcExpr.get()->getType();
   if (DestType.getUnqualifiedType()->isVoidType())
     return;
-  if ((SrcType->isPointerOrObjCObjectPointerType() || SrcType->isBlockPointerType())
-      && (DestType->isPointerOrObjCObjectPointerType() || DestType->isBlockPointerType()))
+  if ((SrcType->isPointerOrObjCObjectPointerType() ||
+       SrcType->isBlockPointerType()) &&
+      (DestType->isPointerOrObjCObjectPointerType() ||
+       DestType->isBlockPointerType()))
     return;
   if (SrcType->isIntegerType() && DestType->isIntegerType() &&
       (SrcType->isBooleanType() == DestType->isBooleanType()) &&
@@ -3318,7 +3324,8 @@ static void DiagnoseCastQual(Sema &Self, const ExprResult &SrcExpr,
     return;
 
   QualType SrcType = SrcExpr.get()->getType();
-  if (!((SrcType->isPointerOrObjCObjectPointerType() && DestType->isPointerOrObjCObjectPointerType()) ||
+  if (!((SrcType->isPointerOrObjCObjectPointerType() &&
+         DestType->isPointerOrObjCObjectPointerType()) ||
         DestType->isLValueReferenceType()))
     return;
 
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 629938ea30d6bb..6f2e51e69f76fc 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4281,7 +4281,8 @@ ExprResult Sema::BuiltinAtomicOverloaded(ExprResult TheCallResult) {
   }
 
   QualType ValType = pointerType->getPointeeType();
-  if (!ValType->isIntegerType() && !ValType->isPointerOrObjCObjectPointerType() &&
+  if (!ValType->isIntegerType() &&
+      !ValType->isPointerOrObjCObjectPointerType() &&
       !ValType->isBlockPointerType()) {
     Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intptr)
         << FirstArg->getType() << 0 << FirstArg->getSourceRange();
@@ -4658,7 +4659,8 @@ ExprResult Sema::BuiltinNontemporalOverloaded(ExprResult TheCallResult) {
 
   // Strip any qualifiers off ValType.
   ValType = ValType.getUnqualifiedType();
-  if (!ValType->isIntegerType() && !ValType->isPointerOrObjCObjectPointerType() &&
+  if (!ValType->isIntegerType() &&
+      !ValType->isPointerOrObjCObjectPointerType() &&
       !ValType->isBlockPointerType() && !ValType->isFloatingType() &&
       !ValType->isVectorType()) {
     Diag(DRE->getBeginLoc(),
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 91ee9685f6f750..f42a7d2d20e3f7 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -5012,9 +5012,10 @@ void SemaCodeCompletion::CodeCompleteExpression(
 
   bool PreferredTypeIsPointer = false;
   if (!Data.PreferredType.isNull()) {
-    PreferredTypeIsPointer = Data.PreferredType->isPointerOrObjCObjectPointerType() ||
-                             Data.PreferredType->isMemberPointerType() ||
-                             Data.PreferredType->isBlockPointerType();
+    PreferredTypeIsPointer =
+        Data.PreferredType->isPointerOrObjCObjectPointerType() ||
+        Data.PreferredType->isMemberPointerType() ||
+        Data.PreferredType->isBlockPointerType();
     if (Data.PreferredType->isEnumeralType()) {
       EnumDecl *Enum = Data.PreferredType->castAs<EnumType>()->getDecl();
       if (auto *Def = Enum->getDefinition())
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 6cf7c585529888..30fe6eba42035e 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -1763,7 +1763,8 @@ static void handleTLSModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
 
 static void handleRestrictAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
   QualType ResultType = getFunctionOrMethodResultType(D);
-  if (ResultType->isPointerOrObjCObjectPointerType() || ResultType->isBlockPointerType()) {
+  if (ResultType->isPointerOrObjCObjectPointerType() ||
+      ResultType->isBlockPointerType()) {
     D->addAttr(::new (S.Context) RestrictAttr(S.Context, AL));
     return;
   }
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index b1b0061a77c9a4..40db9cbfc68661 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -7974,9 +7974,10 @@ static bool checkCondition(Sema &S, const Expr *Cond,
 /// true otherwise.
 static bool checkConditionalNullPointer(Sema &S, ExprResult &NullExpr,
                                         QualType PointerTy) {
-  if ((!PointerTy->isPointerOrObjCObjectPointerType() && !PointerTy->isBlockPointerType()) ||
+  if ((!PointerTy->isPointerOrObjCObjectPointerType() &&
+       !PointerTy->isBlockPointerType()) ||
       !NullExpr.get()->isNullPointerConstant(S.Context,
-                                            Expr::NPC_ValueDependentIsNull))
+                                             Expr::NPC_ValueDependentIsNull))
     return true;
 
   NullExpr = S.ImpCastExprToType(NullExpr.get(), PointerTy, CK_NullToPointer);
@@ -10765,7 +10766,8 @@ static bool checkArithmeticOpPointerOperand(Sema &S, SourceLocation Loc,
   if (const AtomicType *ResAtomicType = ResType->getAs<AtomicType>())
     ResType = ResAtomicType->getValueType();
 
-  if (!ResType->isPointerOrObjCObjectPointerType()) return true;
+  if (!ResType->isPointerOrObjCObjectPointerType())
+    return true;
 
   QualType PointeeTy = ResType->getPointeeType();
   if (PointeeTy->isVoidType()) {
@@ -11594,8 +11596,10 @@ static bool convertPointersToCompositeType(Sema &S, SourceLocation Loc,
 
   QualType T = S.FindCompositePointerType(Loc, LHS, RHS);
   if (T.isNull()) {
-    if ((LHSType->isPointerOrObjCObjectPointerType() || LHSType->isMemberPointerType()) &&
-        (RHSType->isPointerOrObjCObjectPointerType() || RHSType->isMemberPointerType()))
+    if ((LHSType->isPointerOrObjCObjectPointerType() ||
+         LHSType->isMemberPointerType()) &&
+        (RHSType->isPointerOrObjCObjectPointerType() ||
+         RHSType->isMemberPointerType()))
       diagnoseDistinctPointerComparison(S, Loc, LHS, RHS, /*isError*/true);
     else
       S.InvalidOperands(Loc, LHS, RHS);
@@ -12171,7 +12175,7 @@ void Sema::CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE) {
   if (!E.get()->getType()->isPointerOrObjCObjectPointerType() &&
       E.get()->isNullPointerConstant(Context,
                                      Expr::NPC_ValueDependentIsNotNull) ==
-        Expr::NPCK_ZeroExpression) {
+          Expr::NPCK_ZeroExpression) {
     if (const auto *CL = dyn_cast<CharacterLiteral>(E.get())) {
       if (CL->getValue() == 0)
         Diag(E.get()->getExprLoc(), diag::warn_pointer_compare)
@@ -12605,8 +12609,10 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
       return computeResultTy();
     }
   }
-  if ((LHSType->isPointerOrObjCObjectPointerType() && RHSType->isIntegerType()) ||
-      (LHSType->isIntegerType() && RHSType->isPointerOrObjCObjectPointerType())) {
+  if ((LHSType->isPointerOrObjCObjectPointerType() &&
+       RHSType->isIntegerType()) ||
+      (LHSType->isIntegerType() &&
+       RHSType->isPointerOrObjCObjectPointerType())) {
     unsigned DiagID = 0;
     bool isError = false;
     if (LangOpts.DebuggerSupport) {
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 7ba98ed49ebb76..f025c2dede44de 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -7276,10 +7276,10 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc,
 
   //   where at least one is a pointer or pointer to member type or
   //   std::nullptr_t is:
-  bool T1IsPointerLike = T1->isPointerOrObjCObjectPointerType() || T1->isMemberPointerType() ||
-                         T1->isNullPtrType();
-  bool T2IsPointerLike = T2->isPointerOrObjCObjectPointerType() || T2->isMemberPointerType() ||
-                         T2->isNullPtrType();
+  bool T1IsPointerLike = T1->isPointerOrObjCObjectPointerType() ||
+                         T1->isMemberPointerType() || T1->isNullPtrType();
+  bool T2IsPointerLike = T2->isPointerOrObjCObjectPointerType() ||
+                         T2->isMemberPointerType() || T2->isNullPtrType();
   if (!T1IsPointerLike && !T2IsPointerLike)
     return QualType();
 
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 7a49bed5500675..a2c1fbe0d06207 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -5481,7 +5481,8 @@ bool FunctionCallFilterCCC::ValidateCandidate(const TypoCorrection &candidate) {
         QualType ValType = cast<ValueDecl>(ND)->getType();
         if (ValType.isNull())
           continue;
-        if (ValType->isPointerOrObjCObjectPointerType() || ValType->isReferenceType())
+        if (ValType->isPointerOrObjCObjectPointerType() ||
+            ValType->isReferenceType())
           ValType = ValType->getPointeeType();
         if (const FunctionProtoType *FPT = ValType->getAs<FunctionProtoType>())
           if (FPT->getNumParams() == NumArgs)
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 3849733973327e..971f04d356a068 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -17344,8 +17344,8 @@ OMPClause *SemaOpenMP::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
 
     OpenMPDirectiveKind CurrDir = DSAStack->getCurrentDirective();
     // Variably modified types are not supported for tasks.
-    if (!Type->isPointerOrObjCObjectPointerType() && Type->isVariablyModifiedType() &&
-        isOpenMPTaskingDirective(CurrDir)) {
+    if (!Type->isPointerOrObjCObjectPointerType() &&
+        Type->isVariablyModifiedType() && isOpenMPTaskingDirective(CurrDir)) {
       Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
           << getOpenMPClauseName(OMPC_private) << Type
           << getOpenMPDirectiveName(CurrDir);
@@ -17619,7 +17619,8 @@ OMPClause *SemaOpenMP::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
     }
 
     // Variably modified types are not supported for tasks.
-    if (!Type->isPointerOrObjCObjectPointerType() && Type->isVariablyModifiedType() &&
+    if (!Type->isPointerOrObjCObjectPointerType() &&
+        Type->isVariablyModifiedType() &&
         isOpenMPTaskingDirective(DSAStack->getCurrentDirective())) {
       Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
           << getOpenMPClauseName(OMPC_firstprivate) << Type
@@ -19744,7 +19745,8 @@ OMPClause *SemaOpenMP::ActOnOpenMPCopyprivateClause(ArrayRef<Expr *> VarList,
     }
 
     // Variably modified types are not supported.
-    if (!Type->isPointerOrObjCObjectPointerType() && Type->isVariablyModifiedType()) {
+    if (!Type->isPointerOrObjCObjectPointerType() &&
+        Type->isVariablyModifiedType()) {
       Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
           << getOpenMPClauseName(OMPC_copyprivate) << Type
           << getOpenMPDirectiveName(DSAStack->getCurrentDirective());
@@ -20490,7 +20492,8 @@ class MapBaseChecker final : public StmtVisitor<MapBaseChecker, bool> {
   bool VisitArraySubscriptExpr(ArraySubscriptExpr *AE) {
     Expr *E = AE->getBase()->IgnoreParenImpCasts();
 
-    if (!E->getType()->isPointerOrObjCObjectPointerType() && !E->getType()->isArrayType()) {
+    if (!E->getType()->isPointerOrObjCObjectPointerType() &&
+        !E->getType()->isArrayType()) {
       if (!NoDiagnose) {
         SemaRef.Diag(ELoc, diag::err_omp_expected_base_var_name)
             << 0 << AE->getSourceRange();
@@ -24010,7 +24013,8 @@ ExprResult SemaOpenMP::ActOnOMPIteratorExpr(Scope *S,
                              DeclTy->containsUnexpandedParameterPack() ||
                              DeclTy->isInstantiationDependentType();
     if (!IsDeclTyDependent) {
-      if (!DeclTy->isIntegralType(Context) && !DeclTy->isPointerOrObjCObjectPointerType()) {
+      if (!DeclTy->isIntegralType(Context) &&
+          !DeclTy->isPointerOrObjCObjectPointerType()) {
         // OpenMP 5.0, 2.1.6 Iterators, Restrictions, C/C++
         // The iterator-type must be an integral or pointer type.
         Diag(StartLoc, diag::err_omp_iterator_not_integral_or_pointer)
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index dc944763095d5e..791f7d1d2ef9e2 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -301,7 +301,8 @@ isPointerConversionToVoidPointer(ASTContext& Context) const {
   if (First == ICK_Array_To_Pointer)
     FromType = Context.getArrayDecayedType(FromType);
 
-  if (Second == ICK_Pointer_Conversion && FromType->isPointerOrObjCObjectPointerType())
+  if (Second == ICK_Pointer_Conversion &&
+      FromType->isPointerOrObjCObjectPointerType())
     if (const PointerType* ToPtrType = ToType->getAs<PointerType>())
       return ToPtrType->getPointeeType()->isVoidType();
 
@@ -3439,7 +3440,8 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
 
   Kind = CK_BitCast;
 
-  if (Diagnose && !IsCStyleOrFunctionalCast && !FromType->isPointerOrObjCObjectPointerType() &&
+  if (Diagnose && !IsCStyleOrFunctionalCast &&
+      !FromType->isPointerOrObjCObjectPointerType() &&
       From->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNotNull) ==
           Expr::NPCK_ZeroExpression) {
     if (Context.hasSameUnqualifiedType(From->getType(), Context.BoolTy))
@@ -8631,8 +8633,8 @@ BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants(QualType Ty,
     // Skip over restrict if no restrict found anywhere in the types, or if
     // the type cannot be restrict-qualified.
     if ((CVR & Qualifiers::Restrict) &&
-        (!hasRestrict ||
-         (!(PointeeTy->isPointerOrObjCObjectPointerType() || PointeeTy->isReferenceType()))))
+        (!hasRestrict || (!(PointeeTy->isPointerOrObjCObjectPointerType() ||
+                            PointeeTy->isReferenceType()))))
       continue;
 
     // Build qualified pointee type.
@@ -9050,7 +9052,6 @@ class BuiltinOperatorOverloadBuilder {
         S.AddBuiltinCandidate(ParamTypes, Args, CandidateSet);
       }
     }
-
   }
 
   /// Helper to add an overload candidate for a binary builtin with types \p L
diff --git a/clang/lib/Sema/SemaRISCV.cpp b/clang/lib/Sema/SemaRISCV.cpp
index 9aa0c13c759f82..2d82a13f80bcb8 100644
--- a/clang/lib/Sema/SemaRISCV.cpp
+++ b/clang/lib/Sema/SemaRISCV.cpp
@@ -1339,7 +1339,8 @@ bool SemaRISCV::CheckBuiltinFunctionCall(const TargetInfo &TI,
 
     QualType ValType = PtrType->getPointeeType();
     ValType = ValType.getUnqualifiedType();
-    if (!ValType->isIntegerType() && !ValType->isPointerOrObjCObjectPointerType() &&
+    if (!ValType->isIntegerType() &&
+        !ValType->isPointerOrObjCObjectPointerType() &&
         !ValType->isBlockPointerType() && !ValType->isFloatingType() &&
         !ValType->isVectorType() && !ValType->isRVVSizelessBuiltinType()) {
       Diag(DRE->getBeginLoc(),
diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp
index 8c7769a1ec05c1..e09b26baf12f47 100644
--- a/clang/lib/Sema/SemaSYCL.cpp
+++ b/clang/lib/Sema/SemaSYCL.cpp
@@ -114,8 +114,8 @@ void SemaSYCL::deepTypeCheckForDevice(SourceLocation UsedAt,
 
     // In case pointer/array/reference type is met get pointee type, then
     // proceed with that type.
-    while (NextTy->isPointerOrObjCObjectPointerType() || NextTy->isArrayType() ||
-           NextTy->isReferenceType()) {
+    while (NextTy->isPointerOrObjCObjectPointerType() ||
+           NextTy->isArrayType() || NextTy->isReferenceType()) {
       if (NextTy->isArrayType())
         NextTy = QualType{NextTy->getArrayElementTypeNoTypeQual(), 0};
       else
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
index 863358d2609545..e90ff3f80e411c 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp
@@ -30,7 +30,8 @@ static bool AreTypesCompatible(QualType Derived, QualType Ancestor,
 
   // Right now don't compare the compatibility of pointers.  That involves
   // looking at subtyping relationships.  FIXME: Future patch.
-  if (Derived->isPointerOrObjCObjectPointerType() &&  Ancestor->isPointerOrObjCObjectPointerType())
+  if (Derived->isPointerOrObjCObjectPointerType() &&
+      Ancestor->isPointerOrObjCObjectPointerType())
     return true;
 
   return C.typesAreCompatible(Derived, Ancestor);
diff --git a/clang/lib/StaticAnalyzer/Core/DynamicType.cpp b/clang/lib/StaticAnalyzer/Core/DynamicType.cpp
index 480c65217a564b..54831176afcaab 100644
--- a/clang/lib/StaticAnalyzer/Core/DynamicType.cpp
+++ b/clang/lib/StaticAnalyzer/Core/DynamicType.cpp
@@ -117,7 +117,8 @@ ProgramStateRef setDynamicTypeAndCastInfo(ProgramStateRef State,
     return State;
 
   if (CastSucceeds) {
-    assert((CastToTy->isPointerOrObjCObjectPointerType() || CastToTy->isReferenceType()) &&
+    assert((CastToTy->isPointerOrObjCObjectPointerType() ||
+            CastToTy->isReferenceType()) &&
            "DynamicTypeInfo should always be a pointer.");
     State = State->set<DynamicTypeMap>(MR, CastToTy);
   }

>From 4c4537ea05126bce4b7d1914fea8b11bae0f06eb Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Mon, 13 Jan 2025 21:53:35 +0100
Subject: [PATCH 3/5] Rename getPointeeOrArrayElementType()

---
 .../bugprone/SuspiciousMemoryComparisonCheck.cpp         | 2 +-
 clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp   | 2 +-
 clang-tools-extra/clangd/SemanticHighlighting.cpp        | 2 +-
 clang/include/clang/AST/Type.h                           | 9 ++++++---
 clang/lib/AST/ASTImporter.cpp                            | 2 +-
 clang/lib/CodeGen/CGExpr.cpp                             | 2 +-
 clang/lib/CodeGen/CGHLSLRuntime.cpp                      | 2 +-
 clang/lib/CodeGen/CGOpenMPRuntime.cpp                    | 6 +++---
 clang/lib/CodeGen/Targets/SystemZ.cpp                    | 2 +-
 clang/lib/Sema/SemaChecking.cpp                          | 2 +-
 clang/lib/Sema/SemaDecl.cpp                              | 6 +++---
 clang/lib/Sema/SemaExpr.cpp                              | 4 ++--
 clang/lib/Sema/SemaInit.cpp                              | 4 ++--
 clang/lib/Sema/SemaOpenCL.cpp                            | 2 +-
 14 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
index 84957e0b8190c0..2ecaa89d556466 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
@@ -45,7 +45,7 @@ void SuspiciousMemoryComparisonCheck::check(
   for (unsigned int ArgIndex = 0; ArgIndex < 2; ++ArgIndex) {
     const Expr *ArgExpr = CE->getArg(ArgIndex);
     QualType ArgType = ArgExpr->IgnoreImplicit()->getType();
-    const Type *PointeeType = ArgType->getPointeeOrArrayElementType();
+    const Type *PointeeType = ArgType->getPointerOrObjCPointerOrArrayElementType();
     assert(PointeeType != nullptr && "PointeeType should always be available.");
     QualType PointeeQualifiedType(PointeeType, 0);
 
diff --git a/clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp b/clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp
index 5abe4f77d65984..36628d0fd84be5 100644
--- a/clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp
+++ b/clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp
@@ -229,7 +229,7 @@ static bool isTypedefTypeMatching(const TypedefType *const Typedef,
 /// \returns type of the argument
 static const Type *argumentType(const CallExpr *const CE, const size_t Idx) {
   const QualType QT = CE->getArg(Idx)->IgnoreImpCasts()->getType();
-  return QT.getTypePtr()->getPointeeOrArrayElementType();
+  return QT.getTypePtr()->getPointerOrObjCPointerOrArrayElementType();
 }
 
 void TypeMismatchCheck::registerMatchers(MatchFinder *Finder) {
diff --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index e6d16af2495fec..238b28eb976960 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -296,7 +296,7 @@ bool isDefaultLibrary(const Decl *D) {
 bool isDefaultLibrary(const Type *T) {
   if (!T)
     return false;
-  const Type *Underlying = T->getPointeeOrArrayElementType();
+  const Type *Underlying = T->getPointerOrObjCPointerOrArrayElementType();
   if (Underlying->isBuiltinType())
     return true;
   if (auto *TD = dyn_cast<TemplateTypeParmType>(Underlying))
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 437343788227bc..79557441a926fd 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2863,10 +2863,13 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
   /// This should never be used when type qualifiers are meaningful.
   const Type *getArrayElementTypeNoTypeQual() const;
 
-  /// If this is a pointer type, return the pointee type.
+  /// If this is a C or ObjC pointer type, return the pointee type. Notably,
+  /// this does not handle things like member pointers or block pointers.
+  ///
   /// If this is an array type, return the array element type.
+  ///
   /// This should never be used when type qualifiers are meaningful.
-  const Type *getPointeeOrArrayElementType() const;
+  const Type *getPointerOrObjCPointerOrArrayElementType() const;
 
   /// If this is a pointer, ObjC object pointer, or block
   /// pointer, this returns the respective pointee.
@@ -8691,7 +8694,7 @@ inline const Type *Type::getBaseElementTypeUnsafe() const {
   return type;
 }
 
-inline const Type *Type::getPointeeOrArrayElementType() const {
+inline const Type *Type::getPointerOrObjCPointerOrArrayElementType() const {
   const Type *type = this;
   if (type->isPointerOrObjCObjectPointerType())
     return type->getPointeeType().getTypePtr();
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index dec4c7221bc776..654dd050a74ada 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -1942,7 +1942,7 @@ Error ASTNodeImporter::ImportDeclParts(
       FunDecl->hasBody()) {
     auto getLeafPointeeType = [](const Type *T) {
       while (T->isPointerType() || T->isArrayType()) {
-        T = T->getPointeeOrArrayElementType();
+        T = T->getPointerOrObjCPointerOrArrayElementType();
       }
       return T;
     };
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 6e5a21c8f01e78..5d4978f2b47c1f 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -991,7 +991,7 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF,
 
   CodeGenFunction::SanitizerScope SanScope(&CGF);
 
-  QualType EltTy{Base->getType()->getPointeeOrArrayElementType(), 0};
+  QualType EltTy{Base->getType()->getPointerOrObjCPointerOrArrayElementType(), 0};
   if (llvm::Value *POS = CGF.LoadPassedObjectSize(Base, EltTy)) {
     IndexedType = Base->getType();
     return POS;
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 5679bd71581795..e924138df7b86d 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -290,7 +290,7 @@ calculateElementType(const ASTContext &Context, const clang::Type *ResourceTy) {
 }
 
 void CGHLSLRuntime::annotateHLSLResource(const VarDecl *D, GlobalVariable *GV) {
-  const Type *Ty = D->getType()->getPointeeOrArrayElementType();
+  const Type *Ty = D->getType()->getPointerOrObjCPointerOrArrayElementType();
   if (!Ty)
     return;
   const auto *RD = Ty->getAsCXXRecordDecl();
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index ba42f1e39889ae..7c130d43874ba3 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -7551,7 +7551,7 @@ class MappableExprsHandler {
           // For the case that having pointer as base, we need to remove one
           // level of indirection.
           if (&Component != &*Components.begin())
-            ElementType = ElementType->getPointeeOrArrayElementType();
+            ElementType = ElementType->getPointerOrObjCPointerOrArrayElementType();
           ElementTypeSize =
               Context.getTypeSizeInChars(ElementType).getQuantity();
           CurStrides.push_back(
@@ -8628,10 +8628,10 @@ class MappableExprsHandler {
     llvm::SmallVector<const FieldDecl *, 4> Layout;
     if (!OverlappedData.empty()) {
       const Type *BaseType = VD->getType().getCanonicalType().getTypePtr();
-      const Type *OrigType = BaseType->getPointeeOrArrayElementType();
+      const Type *OrigType = BaseType->getPointerOrObjCPointerOrArrayElementType();
       while (BaseType != OrigType) {
         BaseType = OrigType->getCanonicalTypeInternal().getTypePtr();
-        OrigType = BaseType->getPointeeOrArrayElementType();
+        OrigType = BaseType->getPointerOrObjCPointerOrArrayElementType();
       }
 
       if (const auto *CRD = BaseType->getAsCXXRecordDecl())
diff --git a/clang/lib/CodeGen/Targets/SystemZ.cpp b/clang/lib/CodeGen/Targets/SystemZ.cpp
index 23c96fa5cf98cb..edf5a896848981 100644
--- a/clang/lib/CodeGen/Targets/SystemZ.cpp
+++ b/clang/lib/CodeGen/Targets/SystemZ.cpp
@@ -503,7 +503,7 @@ bool SystemZTargetCodeGenInfo::isVectorTypeBased(const Type *Ty,
 
   // Assume pointers are dereferenced.
   while (Ty->isPointerType() || Ty->isArrayType())
-    Ty = Ty->getPointeeOrArrayElementType();
+    Ty = Ty->getPointerOrObjCPointerOrArrayElementType();
 
   // Vectors >= 16 bytes expose the ABI through alignment requirements.
   if (Ty->isVectorType() && Ctx.getTypeSize(Ty) / 8 >= 16)
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 6f2e51e69f76fc..4e78ea98a72005 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -13424,7 +13424,7 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
     return;
 
   const Type *EffectiveType =
-      BaseExpr->getType()->getPointeeOrArrayElementType();
+      BaseExpr->getType()->getPointerOrObjCPointerOrArrayElementType();
   BaseExpr = BaseExpr->IgnoreParenCasts();
   const ConstantArrayType *ArrayTy =
       Context.getAsConstantArrayType(BaseExpr->getType());
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1dffa174f3c2f9..dc70dfe35153ab 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9541,7 +9541,7 @@ static OpenCLParamType getOpenCLKernelParameterType(Sema &S, QualType PT) {
 
   // Look into an array argument to check if it has a forbidden type.
   if (PT->isArrayType()) {
-    const Type *UnderlyingTy = PT->getPointeeOrArrayElementType();
+    const Type *UnderlyingTy = PT->getPointerOrObjCPointerOrArrayElementType();
     // Call ourself to check an underlying type of an array. Since the
     // getPointeeOrArrayElementType returns an innermost type which is not an
     // array, this recursive call only happens once.
@@ -9644,7 +9644,7 @@ static void checkIsValidOpenCLKernelParameter(
   // an ArrayType of a RecordType.
   assert((PT->isArrayType() || PT->isRecordType()) && "Unexpected type.");
   const RecordType *RecTy =
-      PT->getPointeeOrArrayElementType()->getAs<RecordType>();
+      PT->getPointerOrObjCPointerOrArrayElementType()->getAs<RecordType>();
   const RecordDecl *OrigRecDecl = RecTy->getDecl();
 
   VisitStack.push_back(RecTy->getDecl());
@@ -9672,7 +9672,7 @@ static void checkIsValidOpenCLKernelParameter(
       // walk around RecordDecl::fields().
       assert((FieldTy->isArrayType() || FieldTy->isRecordType()) &&
              "Unexpected type.");
-      const Type *FieldRecTy = FieldTy->getPointeeOrArrayElementType();
+      const Type *FieldRecTy = FieldTy->getPointerOrObjCPointerOrArrayElementType();
 
       RD = FieldRecTy->castAs<RecordType>()->getDecl();
     } else {
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 40db9cbfc68661..64ea1212274737 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -17069,8 +17069,8 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
       return Type->isSpecificBuiltinType(BuiltinType::Char_S) ||
              Type->isSpecificBuiltinType(BuiltinType::Char_U);
     };
-    FDiag << (isPlainChar(FirstType->getPointeeOrArrayElementType()) ||
-              isPlainChar(SecondType->getPointeeOrArrayElementType()));
+    FDiag << (isPlainChar(FirstType->getPointerOrObjCPointerOrArrayElementType()) ||
+              isPlainChar(SecondType->getPointerOrObjCPointerOrArrayElementType()));
   }
 
   // If we can fix the conversion, suggest the FixIts.
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 0dd5f468cf60bf..9f7cc798aa8ba7 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -7878,8 +7878,8 @@ ExprResult InitializationSequence::Perform(Sema &S,
       if (MTETy->isIncompleteArrayType() &&
           !CurInit.get()->getType()->isIncompleteArrayType() &&
           S.Context.hasSameType(
-              MTETy->getPointeeOrArrayElementType(),
-              CurInit.get()->getType()->getPointeeOrArrayElementType()))
+              MTETy->getPointerOrObjCPointerOrArrayElementType(),
+              CurInit.get()->getType()->getPointerOrObjCPointerOrArrayElementType()))
         MTETy = CurInit.get()->getType();
 
       // Materialize the temporary into memory.
diff --git a/clang/lib/Sema/SemaOpenCL.cpp b/clang/lib/Sema/SemaOpenCL.cpp
index 9f746fffd34d0a..bbe96cfe17e210 100644
--- a/clang/lib/Sema/SemaOpenCL.cpp
+++ b/clang/lib/Sema/SemaOpenCL.cpp
@@ -324,7 +324,7 @@ bool SemaOpenCL::checkBuiltinEnqueueKernel(CallExpr *TheCall) {
     // Fifth argument is always passed as a pointer to clk_event_t.
     if (!Arg4->isNullPointerConstant(Context,
                                      Expr::NPC_ValueDependentIsNotNull) &&
-        !Arg4->getType()->getPointeeOrArrayElementType()->isClkEventT()) {
+        !Arg4->getType()->getPointerOrObjCPointerOrArrayElementType()->isClkEventT()) {
       Diag(TheCall->getArg(4)->getBeginLoc(),
            diag::err_opencl_builtin_expected_type)
           << TheCall->getDirectCallee()

>From 40eddf97d0b7a91a7f4481c281c88a7e4e7496dc Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Mon, 13 Jan 2025 21:54:01 +0100
Subject: [PATCH 4/5] clang-format

---
 .../clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp | 3 ++-
 clang/lib/CodeGen/CGExpr.cpp                                | 3 ++-
 clang/lib/CodeGen/CGOpenMPRuntime.cpp                       | 6 ++++--
 clang/lib/Sema/SemaDecl.cpp                                 | 3 ++-
 clang/lib/Sema/SemaExpr.cpp                                 | 6 ++++--
 clang/lib/Sema/SemaInit.cpp                                 | 4 +++-
 clang/lib/Sema/SemaOpenCL.cpp                               | 4 +++-
 7 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
index 2ecaa89d556466..7779b6725673cb 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SuspiciousMemoryComparisonCheck.cpp
@@ -45,7 +45,8 @@ void SuspiciousMemoryComparisonCheck::check(
   for (unsigned int ArgIndex = 0; ArgIndex < 2; ++ArgIndex) {
     const Expr *ArgExpr = CE->getArg(ArgIndex);
     QualType ArgType = ArgExpr->IgnoreImplicit()->getType();
-    const Type *PointeeType = ArgType->getPointerOrObjCPointerOrArrayElementType();
+    const Type *PointeeType =
+        ArgType->getPointerOrObjCPointerOrArrayElementType();
     assert(PointeeType != nullptr && "PointeeType should always be available.");
     QualType PointeeQualifiedType(PointeeType, 0);
 
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 5d4978f2b47c1f..bba936b3c7f3eb 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -991,7 +991,8 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF,
 
   CodeGenFunction::SanitizerScope SanScope(&CGF);
 
-  QualType EltTy{Base->getType()->getPointerOrObjCPointerOrArrayElementType(), 0};
+  QualType EltTy{Base->getType()->getPointerOrObjCPointerOrArrayElementType(),
+                 0};
   if (llvm::Value *POS = CGF.LoadPassedObjectSize(Base, EltTy)) {
     IndexedType = Base->getType();
     return POS;
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 7c130d43874ba3..12631dc70da9c0 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -7551,7 +7551,8 @@ class MappableExprsHandler {
           // For the case that having pointer as base, we need to remove one
           // level of indirection.
           if (&Component != &*Components.begin())
-            ElementType = ElementType->getPointerOrObjCPointerOrArrayElementType();
+            ElementType =
+                ElementType->getPointerOrObjCPointerOrArrayElementType();
           ElementTypeSize =
               Context.getTypeSizeInChars(ElementType).getQuantity();
           CurStrides.push_back(
@@ -8628,7 +8629,8 @@ class MappableExprsHandler {
     llvm::SmallVector<const FieldDecl *, 4> Layout;
     if (!OverlappedData.empty()) {
       const Type *BaseType = VD->getType().getCanonicalType().getTypePtr();
-      const Type *OrigType = BaseType->getPointerOrObjCPointerOrArrayElementType();
+      const Type *OrigType =
+          BaseType->getPointerOrObjCPointerOrArrayElementType();
       while (BaseType != OrigType) {
         BaseType = OrigType->getCanonicalTypeInternal().getTypePtr();
         OrigType = BaseType->getPointerOrObjCPointerOrArrayElementType();
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index dc70dfe35153ab..0ec4575d73a358 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9672,7 +9672,8 @@ static void checkIsValidOpenCLKernelParameter(
       // walk around RecordDecl::fields().
       assert((FieldTy->isArrayType() || FieldTy->isRecordType()) &&
              "Unexpected type.");
-      const Type *FieldRecTy = FieldTy->getPointerOrObjCPointerOrArrayElementType();
+      const Type *FieldRecTy =
+          FieldTy->getPointerOrObjCPointerOrArrayElementType();
 
       RD = FieldRecTy->castAs<RecordType>()->getDecl();
     } else {
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 64ea1212274737..65009ff80c4b49 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -17069,8 +17069,10 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
       return Type->isSpecificBuiltinType(BuiltinType::Char_S) ||
              Type->isSpecificBuiltinType(BuiltinType::Char_U);
     };
-    FDiag << (isPlainChar(FirstType->getPointerOrObjCPointerOrArrayElementType()) ||
-              isPlainChar(SecondType->getPointerOrObjCPointerOrArrayElementType()));
+    FDiag << (isPlainChar(
+                  FirstType->getPointerOrObjCPointerOrArrayElementType()) ||
+              isPlainChar(
+                  SecondType->getPointerOrObjCPointerOrArrayElementType()));
   }
 
   // If we can fix the conversion, suggest the FixIts.
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 9f7cc798aa8ba7..f7755869c7f5b1 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -7879,7 +7879,9 @@ ExprResult InitializationSequence::Perform(Sema &S,
           !CurInit.get()->getType()->isIncompleteArrayType() &&
           S.Context.hasSameType(
               MTETy->getPointerOrObjCPointerOrArrayElementType(),
-              CurInit.get()->getType()->getPointerOrObjCPointerOrArrayElementType()))
+              CurInit.get()
+                  ->getType()
+                  ->getPointerOrObjCPointerOrArrayElementType()))
         MTETy = CurInit.get()->getType();
 
       // Materialize the temporary into memory.
diff --git a/clang/lib/Sema/SemaOpenCL.cpp b/clang/lib/Sema/SemaOpenCL.cpp
index bbe96cfe17e210..a636f860cc0d42 100644
--- a/clang/lib/Sema/SemaOpenCL.cpp
+++ b/clang/lib/Sema/SemaOpenCL.cpp
@@ -324,7 +324,9 @@ bool SemaOpenCL::checkBuiltinEnqueueKernel(CallExpr *TheCall) {
     // Fifth argument is always passed as a pointer to clk_event_t.
     if (!Arg4->isNullPointerConstant(Context,
                                      Expr::NPC_ValueDependentIsNotNull) &&
-        !Arg4->getType()->getPointerOrObjCPointerOrArrayElementType()->isClkEventT()) {
+        !Arg4->getType()
+             ->getPointerOrObjCPointerOrArrayElementType()
+             ->isClkEventT()) {
       Diag(TheCall->getArg(4)->getBeginLoc(),
            diag::err_opencl_builtin_expected_type)
           << TheCall->getDirectCallee()

>From f0350e1ebdf2fedadfabe99fdcbf2130dd5e3f28 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Mon, 13 Jan 2025 21:54:21 +0100
Subject: [PATCH 5/5] Improve documentation of getPointeeType()

---
 clang/include/clang/AST/Type.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 79557441a926fd..0a505ebbfa1dc6 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2871,8 +2871,15 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
   /// This should never be used when type qualifiers are meaningful.
   const Type *getPointerOrObjCPointerOrArrayElementType() const;
 
-  /// If this is a pointer, ObjC object pointer, or block
-  /// pointer, this returns the respective pointee.
+  /// Return the 'pointee type' for any of the following kinds of types,
+  /// and an empty QualType otherwise.
+  ///
+  ///   - PointerType
+  ///   - ObjCObjectPointerType
+  ///   - BlockPointerType
+  ///   - ReferenceType
+  ///   - MemberPointerType
+  ///   - DecayedType
   QualType getPointeeType() const;
 
   /// Return the specified type with any "sugar" removed from the type,



More information about the lldb-commits mailing list