[cfe-commits] r53832 - in /cfe/trunk: include/clang/AST/Type.h lib/Sema/SemaExpr.cpp lib/Sema/SemaExprObjC.cpp

Chris Lattner sabre at nondot.org
Sun Jul 20 22:20:01 PDT 2008


Author: lattner
Date: Mon Jul 21 00:20:01 2008
New Revision: 53832

URL: http://llvm.org/viewvc/llvm-project?rev=53832&view=rev
Log:
rename getProtocols -> getProtocol, as it only returns a single
protocol.  Simplify some code to use unconditional form of the
protocol access list.

Modified:
    cfe/trunk/include/clang/AST/Type.h
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaExprObjC.cpp

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=53832&r1=53831&r2=53832&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Mon Jul 21 00:20:01 2008
@@ -1130,9 +1130,8 @@
   /// interface type, or 0 if there are none.
   inline unsigned getNumProtocols() const;
   
-  /// getProtocols - Return the specified qualifying protocol.
-  inline ObjCProtocolDecl *getProtocols(unsigned i) const;
-
+  /// getProtocol - Return the specified qualifying protocol.
+  inline ObjCProtocolDecl *getProtocol(unsigned i) const;
   
   
   virtual void getAsStringInternal(std::string &InnerString) const;
@@ -1162,7 +1161,7 @@
   friend class ASTContext;  // ASTContext creates these.
 public:
   
-  ObjCProtocolDecl *getProtocols(unsigned i) const {
+  ObjCProtocolDecl *getProtocol(unsigned i) const {
     return Protocols[i];
   }
   unsigned getNumProtocols() const {
@@ -1207,9 +1206,9 @@
   return 0;
 }
 
-/// getProtocols - Return the specified qualifying protocol.
-inline ObjCProtocolDecl *ObjCInterfaceType::getProtocols(unsigned i) const {
-  return cast<ObjCQualifiedInterfaceType>(this)->getProtocols(i);
+/// getProtocol - Return the specified qualifying protocol.
+inline ObjCProtocolDecl *ObjCInterfaceType::getProtocol(unsigned i) const {
+  return cast<ObjCQualifiedInterfaceType>(this)->getProtocol(i);
 }
   
   

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=53832&r1=53831&r2=53832&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Jul 21 00:20:01 2008
@@ -654,13 +654,10 @@
       return new ObjCPropertyRefExpr(PD, PD->getType(), MemberLoc, BaseExpr);
     
     // Lastly, check protocols on qualified interfaces.
-    if (const ObjCQualifiedInterfaceType *QIT = 
-          dyn_cast<ObjCQualifiedInterfaceType>(IFTy)) {
-      for (unsigned i = 0; i != QIT->getNumProtocols(); ++i)
-        if (ObjCPropertyDecl *PD =
-              QIT->getProtocols(i)->FindPropertyDeclaration(&Member))
-          return new ObjCPropertyRefExpr(PD, PD->getType(), MemberLoc,BaseExpr);
-    }
+    for (ObjCInterfaceType::qual_iterator I = IFTy->qual_begin(),
+         E = IFTy->qual_end(); I != E; ++I)
+      if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(&Member))
+        return new ObjCPropertyRefExpr(PD, PD->getType(), MemberLoc, BaseExpr);
   }
   
   // Handle 'field access' to vectors, such as 'V.xx'.

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=53832&r1=53831&r2=53832&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Mon Jul 21 00:20:01 2008
@@ -284,7 +284,7 @@
       if (!Method) {
         // search protocols
         for (unsigned i = 0; i < QIT->getNumProtocols(); i++) {
-          ObjCProtocolDecl *PDecl = QIT->getProtocols(i);
+          ObjCProtocolDecl *PDecl = QIT->getProtocol(i);
           if (PDecl && (Method = PDecl->lookupInstanceMethod(Sel)))
             break;
         }





More information about the cfe-commits mailing list