[clang] 2caf757 - [Clang][AST] Resolve FIXME: Remove ObjCObjectPointer from

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 20 10:35:07 PDT 2021


Author: Alfonso Gregory
Date: 2021-10-20T10:32:46-07:00
New Revision: 2caf7571e1020ae1024ab3f2d52ecc9aea85687d

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

LOG: [Clang][AST] Resolve FIXME: Remove ObjCObjectPointer from
isSpecifierType

There is no reason to have this here, (since all tests pass) and it
isn't even a specifier anyway. We can just treat it as a pointer
instead.

Differential Revision: https://reviews.llvm.org/D110068

Added: 
    

Modified: 
    clang/lib/AST/DeclPrinter.cpp
    clang/lib/AST/Type.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 4dcf3d0e6ab12..f2d7a792567d4 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -153,11 +153,14 @@ static QualType GetBaseType(QualType T) {
   while (!BaseType->isSpecifierType()) {
     if (const PointerType *PTy = BaseType->getAs<PointerType>())
       BaseType = PTy->getPointeeType();
+    else if (const ObjCObjectPointerType *OPT =
+                 BaseType->getAs<ObjCObjectPointerType>())
+      BaseType = OPT->getPointeeType();
     else if (const BlockPointerType *BPy = BaseType->getAs<BlockPointerType>())
       BaseType = BPy->getPointeeType();
-    else if (const ArrayType* ATy = dyn_cast<ArrayType>(BaseType))
+    else if (const ArrayType *ATy = dyn_cast<ArrayType>(BaseType))
       BaseType = ATy->getElementType();
-    else if (const FunctionType* FTy = BaseType->getAs<FunctionType>())
+    else if (const FunctionType *FTy = BaseType->getAs<FunctionType>())
       BaseType = FTy->getReturnType();
     else if (const VectorType *VTy = BaseType->getAs<VectorType>())
       BaseType = VTy->getElementType();

diff  --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 58cae0378a98c..e7cdf58839631 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -2785,7 +2785,6 @@ bool Type::isSpecifierType() const {
   case DependentTemplateSpecialization:
   case ObjCInterface:
   case ObjCObject:
-  case ObjCObjectPointer: // FIXME: object pointers aren't really specifiers
     return true;
   default:
     return false;


        


More information about the cfe-commits mailing list