[cfe-commits] r103973 - in /cfe/trunk/lib: Checker/BasicObjCFoundationChecks.cpp Checker/CFRefCount.cpp CodeGen/CGObjCGNU.cpp CodeGen/CGObjCMac.cpp Frontend/RewriteObjC.cpp Sema/SemaDeclAttr.cpp

John McCall rjmccall at apple.com
Mon May 17 14:00:27 PDT 2010


Author: rjmccall
Date: Mon May 17 16:00:27 2010
New Revision: 103973

URL: http://llvm.org/viewvc/llvm-project?rev=103973&view=rev
Log:
Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
out.  The remaining ones are okay.


Modified:
    cfe/trunk/lib/Checker/BasicObjCFoundationChecks.cpp
    cfe/trunk/lib/Checker/CFRefCount.cpp
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
    cfe/trunk/lib/Frontend/RewriteObjC.cpp
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/lib/Checker/BasicObjCFoundationChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/BasicObjCFoundationChecks.cpp?rev=103973&r1=103972&r2=103973&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/BasicObjCFoundationChecks.cpp (original)
+++ cfe/trunk/lib/Checker/BasicObjCFoundationChecks.cpp Mon May 17 16:00:27 2010
@@ -521,11 +521,11 @@
   ObjCInterfaceDecl *Class = 0;
   switch (ME->getReceiverKind()) {
   case ObjCMessageExpr::Class:
-    Class = ME->getClassReceiver()->getAs<ObjCInterfaceType>()->getDecl();
+    Class = ME->getClassReceiver()->getAs<ObjCObjectType>()->getInterface();
     break;
 
   case ObjCMessageExpr::SuperClass:
-    Class = ME->getSuperType()->getAs<ObjCInterfaceType>()->getDecl();
+    Class = ME->getSuperType()->getAs<ObjCObjectType>()->getInterface();
     break;
 
   case ObjCMessageExpr::Instance:

Modified: cfe/trunk/lib/Checker/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/CFRefCount.cpp?rev=103973&r1=103972&r2=103973&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Checker/CFRefCount.cpp Mon May 17 16:00:27 2010
@@ -618,11 +618,11 @@
       break;
 
     case ObjCMessageExpr::Class:
-      OD = ME->getClassReceiver()->getAs<ObjCInterfaceType>()->getDecl();
+      OD = ME->getClassReceiver()->getAs<ObjCObjectType>()->getInterface();
       break;
 
     case ObjCMessageExpr::SuperClass:
-      OD = ME->getSuperType()->getAs<ObjCInterfaceType>()->getDecl();
+      OD = ME->getSuperType()->getAs<ObjCObjectType>()->getInterface();
       break;
     }
 

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=103973&r1=103972&r2=103973&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Mon May 17 16:00:27 2010
@@ -1939,11 +1939,11 @@
         const ObjCObjectPointerType *OPT =
           CatchDecl->getType()->getAs<ObjCObjectPointerType>();
         assert(OPT && "Invalid @catch type.");
-        const ObjCInterfaceType *IT =
-          OPT->getPointeeType()->getAs<ObjCInterfaceType>();
-        assert(IT && "Invalid @catch type.");
+        const ObjCInterfaceDecl *IDecl =
+          OPT->getObjectType()->getInterface();
+        assert(IDecl && "Invalid @catch type.");
         llvm::Value *EHType =
-          MakeConstantString(IT->getDecl()->getNameAsString());
+          MakeConstantString(IDecl->getNameAsString());
         ESelArgs.push_back(EHType);
       }
     }

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=103973&r1=103972&r2=103973&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Mon May 17 16:00:27 2010
@@ -2701,12 +2701,12 @@
       }
 
       assert(OPT && "Unexpected non-object pointer type in @catch");
-      QualType T = OPT->getPointeeType();
-      const ObjCInterfaceType *ObjCType = T->getAs<ObjCInterfaceType>();
-      assert(ObjCType && "Catch parameter must have Objective-C type!");
+      const ObjCObjectType *ObjTy = OPT->getObjectType();
+      ObjCInterfaceDecl *IDecl = ObjTy->getInterface();
+      assert(IDecl && "Catch parameter must have Objective-C type!");
 
       // Check if the @catch block matches the exception object.
-      llvm::Value *Class = EmitClassRef(CGF.Builder, ObjCType->getDecl());
+      llvm::Value *Class = EmitClassRef(CGF.Builder, IDecl);
 
       llvm::Value *Match =
         CGF.Builder.CreateCall2(ObjCTypes.getExceptionMatchFn(),
@@ -5096,12 +5096,12 @@
 /// @encode
 ///
 LValue CGObjCNonFragileABIMac::EmitObjCValueForIvar(
-  CodeGen::CodeGenFunction &CGF,
-  QualType ObjectTy,
-  llvm::Value *BaseValue,
-  const ObjCIvarDecl *Ivar,
-  unsigned CVRQualifiers) {
-  const ObjCInterfaceDecl *ID = ObjectTy->getAs<ObjCInterfaceType>()->getDecl();
+                                               CodeGen::CodeGenFunction &CGF,
+                                               QualType ObjectTy,
+                                               llvm::Value *BaseValue,
+                                               const ObjCIvarDecl *Ivar,
+                                               unsigned CVRQualifiers) {
+  ObjCInterfaceDecl *ID = ObjectTy->getAs<ObjCObjectType>()->getInterface();
   return EmitValueForIvarAtOffset(CGF, ID, BaseValue, Ivar, CVRQualifiers,
                                   EmitIvarOffset(CGF, ID, Ivar));
 }

Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=103973&r1=103972&r2=103973&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Mon May 17 16:00:27 2010
@@ -1911,13 +1911,13 @@
         buf += "1) { ";
         ReplaceText(startLoc, lParenLoc-startBuf+1, buf);
         sawIdTypedCatch = true;
-      } else if (t->isObjCObjectPointerType()) {
-        QualType InterfaceTy = t->getPointeeType();
-        const ObjCInterfaceType *cls = // Should be a pointer to a class.
-          InterfaceTy->getAs<ObjCInterfaceType>();
-        if (cls) {
+      } else if (const ObjCObjectPointerType *Ptr =
+                   t->getAs<ObjCObjectPointerType>()) {
+        // Should be a pointer to a class.
+        ObjCInterfaceDecl *IDecl = Ptr->getObjectType()->getInterface();
+        if (IDecl) {
           buf += "objc_exception_match((struct objc_class *)objc_getClass(\"";
-          buf += cls->getDecl()->getNameAsString();
+          buf += IDecl->getNameAsString();
           buf += "\"), (struct objc_object *)_caught)) { ";
           ReplaceText(startLoc, lParenLoc-startBuf+1, buf);
         }
@@ -2811,7 +2811,7 @@
     llvm::SmallVector<Expr*, 8> ClsExprs;
     QualType argType = Context->getPointerType(Context->CharTy);
     ObjCInterfaceDecl *Class
-      = Exp->getClassReceiver()->getAs<ObjCInterfaceType>()->getDecl();
+      = Exp->getClassReceiver()->getAs<ObjCObjectType>()->getInterface();
     IdentifierInfo *clsName = Class->getIdentifier();
     ClsExprs.push_back(StringLiteral::Create(*Context,
                                              clsName->getNameStart(),

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=103973&r1=103972&r2=103973&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon May 17 16:00:27 2010
@@ -129,11 +129,11 @@
   if (!PT)
     return false;
 
-  const ObjCInterfaceType *ClsT =PT->getPointeeType()->getAs<ObjCInterfaceType>();
-  if (!ClsT)
+  ObjCInterfaceDecl *Cls = PT->getObjectType()->getInterface();
+  if (!Cls)
     return false;
 
-  IdentifierInfo* ClsName = ClsT->getDecl()->getIdentifier();
+  IdentifierInfo* ClsName = Cls->getIdentifier();
 
   // FIXME: Should we walk the chain of classes?
   return ClsName == &Ctx.Idents.get("NSString") ||





More information about the cfe-commits mailing list