[cfe-commits] r55362 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp

Daniel Dunbar daniel at zuster.org
Mon Aug 25 23:53:45 PDT 2008


Author: ddunbar
Date: Tue Aug 26 01:53:45 2008
New Revision: 55362

URL: http://llvm.org/viewvc/llvm-project?rev=55362&view=rev
Log:
constify ObjC*::getClassMethod,getInstanceMethod 

No (intended) functionality change.

Modified:
    cfe/trunk/include/clang/AST/DeclObjC.h
    cfe/trunk/lib/AST/DeclObjC.cpp

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

==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Aug 26 01:53:45 2008
@@ -418,7 +418,7 @@
 
                                                                            
   // Get the local instance method declared in this interface.
-  ObjCMethodDecl *getInstanceMethod(Selector Sel) {
+  ObjCMethodDecl *getInstanceMethod(Selector Sel) const {
     for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); 
          I != E; ++I) {
       if ((*I)->getSelector() == Sel)
@@ -427,7 +427,7 @@
     return 0;
   }
   // Get the local class method declared in this interface.
-  ObjCMethodDecl *getClassMethod(Selector Sel) {
+  ObjCMethodDecl *getClassMethod(Selector Sel) const {
     for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); 
          I != E; ++I) {
       if ((*I)->getSelector() == Sel)
@@ -645,7 +645,7 @@
   }
 
   // Get the local instance method declared in this interface.
-  ObjCMethodDecl *getInstanceMethod(Selector Sel) {
+  ObjCMethodDecl *getInstanceMethod(Selector Sel) const {
     for (instmeth_iterator I = instmeth_begin(), E = instmeth_end();
          I != E; ++I) {
       if ((*I)->getSelector() == Sel)
@@ -654,7 +654,7 @@
     return 0;
   }
   // Get the local class method declared in this interface.
-  ObjCMethodDecl *getClassMethod(Selector Sel) {
+  ObjCMethodDecl *getClassMethod(Selector Sel) const {
     for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); 
          I != E; ++I) {
       if ((*I)->getSelector() == Sel)
@@ -884,7 +884,7 @@
   }
 
   // Get the local instance method declared in this interface.
-  ObjCMethodDecl *getInstanceMethod(Selector Sel) {
+  ObjCMethodDecl *getInstanceMethod(Selector Sel) const {
     for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); 
          I != E; ++I) {
       if ((*I)->getSelector() == Sel)
@@ -893,7 +893,7 @@
     return 0;
   }
   // Get the local class method declared in this interface.
-  ObjCMethodDecl *getClassMethod(Selector Sel) {
+  ObjCMethodDecl *getClassMethod(Selector Sel) const {
     for (classmeth_iterator I = classmeth_begin(), E = classmeth_end(); 
          I != E; ++I) {
       if ((*I)->getSelector() == Sel)
@@ -971,10 +971,10 @@
     ClassMethods.push_back(method);
   }   
   // Get the instance method definition for this implementation.
-  ObjCMethodDecl *getInstanceMethod(Selector Sel);
+  ObjCMethodDecl *getInstanceMethod(Selector Sel) const;
   
   // Get the class method definition for this implementation.
-  ObjCMethodDecl *getClassMethod(Selector Sel);
+  ObjCMethodDecl *getClassMethod(Selector Sel) const;
   
   void addPropertyImplementation(ObjCPropertyImplDecl *property) {
     PropertyImplementations.push_back(property);
@@ -1114,10 +1114,10 @@
   classmeth_iterator classmeth_end() const { return ClassMethods.end(); }
   
   // Get the instance method definition for this implementation.
-  ObjCMethodDecl *getInstanceMethod(Selector Sel);
+  ObjCMethodDecl *getInstanceMethod(Selector Sel) const;
   
   // Get the class method definition for this implementation.
-  ObjCMethodDecl *getClassMethod(Selector Sel);
+  ObjCMethodDecl *getClassMethod(Selector Sel) const;
   
   typedef ObjCIvarDecl * const *ivar_iterator;
   ivar_iterator ivar_begin() const { return Ivars; }

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=55362&r1=55361&r2=55362&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Aug 26 01:53:45 2008
@@ -410,6 +410,12 @@
        ASTContext &Context,
        ObjCPropertyDecl *property,
        llvm::SmallVector<ObjCMethodDecl*, 32> &insMethods) {
+  // FIXME: The synthesized property we set here is misleading. We
+  // almost always synthesize these methods unless the user explicitly
+  // provided prototypes (which is odd, but allowed). Sema should be
+  // typechecking that the declarations jive in that situation (which
+  // it is not currently).
+
   // Find the default getter and if one not found, add one.
   ObjCMethodDecl *GetterDecl = getInstanceMethod(property->getGetterName());
   if (!GetterDecl) {
@@ -626,20 +632,20 @@
   return NULL;
 }
 
-/// lookupInstanceMethod - This method returns an instance method by looking in
-/// the class implementation. Unlike interfaces, we don't look outside the
-/// implementation.
-ObjCMethodDecl *ObjCImplementationDecl::getInstanceMethod(Selector Sel) {
+/// getInstanceMethod - This method returns an instance method by
+/// looking in the class implementation. Unlike interfaces, we don't
+/// look outside the implementation.
+ObjCMethodDecl *ObjCImplementationDecl::getInstanceMethod(Selector Sel) const {
   for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I)
     if ((*I)->getSelector() == Sel)
       return *I;
   return NULL;
 }
 
-/// lookupClassMethod - This method returns a class method by looking in
-/// the class implementation. Unlike interfaces, we don't look outside the
-/// implementation.
-ObjCMethodDecl *ObjCImplementationDecl::getClassMethod(Selector Sel) {
+/// getClassMethod - This method returns a class method by looking in
+/// the class implementation. Unlike interfaces, we don't look outside
+/// the implementation.
+ObjCMethodDecl *ObjCImplementationDecl::getClassMethod(Selector Sel) const {
   for (classmeth_iterator I = classmeth_begin(), E = classmeth_end();
        I != E; ++I)
     if ((*I)->getSelector() == Sel)
@@ -650,7 +656,7 @@
 // lookupInstanceMethod - This method returns an instance method by looking in
 // the class implementation. Unlike interfaces, we don't look outside the
 // implementation.
-ObjCMethodDecl *ObjCCategoryImplDecl::getInstanceMethod(Selector Sel) {
+ObjCMethodDecl *ObjCCategoryImplDecl::getInstanceMethod(Selector Sel) const {
   for (instmeth_iterator I = instmeth_begin(), E = instmeth_end(); I != E; ++I)
     if ((*I)->getSelector() == Sel)
       return *I;
@@ -660,7 +666,7 @@
 // lookupClassMethod - This method returns an instance method by looking in
 // the class implementation. Unlike interfaces, we don't look outside the
 // implementation.
-ObjCMethodDecl *ObjCCategoryImplDecl::getClassMethod(Selector Sel) {
+ObjCMethodDecl *ObjCCategoryImplDecl::getClassMethod(Selector Sel) const {
   for (classmeth_iterator I = classmeth_begin(), E = classmeth_end();
        I != E; ++I)
     if ((*I)->getSelector() == Sel)





More information about the cfe-commits mailing list