]> granicus.if.org Git - clang/commitdiff
rename getProtocols -> getProtocol, as it only returns a single
authorChris Lattner <sabre@nondot.org>
Mon, 21 Jul 2008 05:20:01 +0000 (05:20 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 21 Jul 2008 05:20:01 +0000 (05:20 +0000)
protocol.  Simplify some code to use unconditional form of the
protocol access list.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53832 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Type.h
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprObjC.cpp

index 03171b859b535a396de000dac066e286cdb94d30..e35f0aae1117c32a745d1e99562432e6b4a47b49 100644 (file)
@@ -1130,9 +1130,8 @@ public:
   /// 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 @@ class ObjCQualifiedInterfaceType : public ObjCInterfaceType,
   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 @@ inline unsigned ObjCInterfaceType::getNumProtocols() const {
   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);
 }
   
   
index 13f7ff9fb711bbce69f60489c4434a4fe3eb1934..9813acbd04511aa8d0d3bdba1bdbc2b4783324c1 100644 (file)
@@ -654,13 +654,10 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
       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'.
index abbc7666e90f7ee4034898ae725be8f780e7fe41..e8830bc0ddf9dc388793aca702d3e5f9713e5856 100644 (file)
@@ -284,7 +284,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(
       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;
         }