[PATCH] D62035: [AST] const-ify ObjC inherited class search

2019-11-21 Thread Brian Gesiak via Phabricator via cfe-commits
modocache abandoned this revision.
modocache added a comment.

I'm not super interested in this patch anymore, someone else feel free to work 
on this! :)


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62035/new/

https://reviews.llvm.org/D62035



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62035: [AST] const-ify ObjC inherited class search

2019-05-30 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment.

I don't really have much to say about this, and the patch is probably fine, but 
I do note that most of the other accessors on this class also return mutable 
objects.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62035/new/

https://reviews.llvm.org/D62035



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62035: [AST] const-ify ObjC inherited class search

2019-05-28 Thread Ben Gertzfield via Phabricator via cfe-commits
beng added a comment.

Thanks! @jyknight might want to take a look (this seems fine to me though).


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62035/new/

https://reviews.llvm.org/D62035



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62035: [AST] const-ify ObjC inherited class search

2019-05-28 Thread Adam Ernst via Phabricator via cfe-commits
adamjernst added a comment.

@beng (hello!!) I've spotted you reviewing some Objective-C clang stuff … can 
you review, or do you have advice on a qualified reviewer?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62035/new/

https://reviews.llvm.org/D62035



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62035: [AST] const-ify ObjC inherited class search

2019-05-16 Thread Brian Gesiak via Phabricator via cfe-commits
modocache created this revision.
modocache added a reviewer: rjmccall.
Herald added a project: clang.

When writing an AST matcher to find inherited Objective-C classes, I
noticed the returned `ObjCInterfaceDecl*` was mutable. It doesn't seem
like it needs to be mutable, so this patch makes it const.

Patch by Adam Ernst.


Repository:
  rC Clang

https://reviews.llvm.org/D62035

Files:
  include/clang/AST/DeclObjC.h
  lib/AST/DeclObjC.cpp
  lib/Sema/SemaDeclObjC.cpp


Index: lib/Sema/SemaDeclObjC.cpp
===
--- lib/Sema/SemaDeclObjC.cpp
+++ lib/Sema/SemaDeclObjC.cpp
@@ -2685,7 +2685,7 @@
   assert (IDecl && "CheckProtocolMethodDefs - IDecl is null");
 
   ObjCInterfaceDecl *Super = IDecl->getSuperClass();
-  ObjCInterfaceDecl *NSIDecl = nullptr;
+  const ObjCInterfaceDecl *NSIDecl = nullptr;
 
   // If this protocol is marked 
'objc_protocol_requires_explicit_implementation'
   // then we should check if any class in the super class hierarchy also
Index: lib/AST/DeclObjC.cpp
===
--- lib/AST/DeclObjC.cpp
+++ lib/AST/DeclObjC.cpp
@@ -646,10 +646,10 @@
 }
 
 /// lookupInheritedClass - This method returns ObjCInterfaceDecl * of the super
-/// class whose name is passed as argument. If it is not one of the super 
classes
-/// the it returns NULL.
-ObjCInterfaceDecl *ObjCInterfaceDecl::lookupInheritedClass(
-const IdentifierInfo*ICName) {
+/// class whose name is passed as argument. If it is not one of the super
+/// classes then it returns NULL.
+const ObjCInterfaceDecl *
+ObjCInterfaceDecl::lookupInheritedClass(const IdentifierInfo *ICName) const {
   // FIXME: Should make sure no callers ever do this.
   if (!hasDefinition())
 return nullptr;
@@ -657,7 +657,7 @@
   if (data().ExternallyCompleted)
 LoadExternalDefinition();
 
-  ObjCInterfaceDecl* ClassDecl = this;
+  auto *ClassDecl = this;
   while (ClassDecl != nullptr) {
 if (ClassDecl->getIdentifier() == ICName)
   return ClassDecl;
Index: include/clang/AST/DeclObjC.h
===
--- include/clang/AST/DeclObjC.h
+++ include/clang/AST/DeclObjC.h
@@ -1852,7 +1852,8 @@
 return lookupMethod(Sel, false/*isInstance*/);
   }
 
-  ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName);
+  const ObjCInterfaceDecl *
+  lookupInheritedClass(const IdentifierInfo *ICName) const;
 
   /// Lookup a method in the classes implementation hierarchy.
   ObjCMethodDecl *lookupPrivateMethod(const Selector ,


Index: lib/Sema/SemaDeclObjC.cpp
===
--- lib/Sema/SemaDeclObjC.cpp
+++ lib/Sema/SemaDeclObjC.cpp
@@ -2685,7 +2685,7 @@
   assert (IDecl && "CheckProtocolMethodDefs - IDecl is null");
 
   ObjCInterfaceDecl *Super = IDecl->getSuperClass();
-  ObjCInterfaceDecl *NSIDecl = nullptr;
+  const ObjCInterfaceDecl *NSIDecl = nullptr;
 
   // If this protocol is marked 'objc_protocol_requires_explicit_implementation'
   // then we should check if any class in the super class hierarchy also
Index: lib/AST/DeclObjC.cpp
===
--- lib/AST/DeclObjC.cpp
+++ lib/AST/DeclObjC.cpp
@@ -646,10 +646,10 @@
 }
 
 /// lookupInheritedClass - This method returns ObjCInterfaceDecl * of the super
-/// class whose name is passed as argument. If it is not one of the super classes
-/// the it returns NULL.
-ObjCInterfaceDecl *ObjCInterfaceDecl::lookupInheritedClass(
-const IdentifierInfo*ICName) {
+/// class whose name is passed as argument. If it is not one of the super
+/// classes then it returns NULL.
+const ObjCInterfaceDecl *
+ObjCInterfaceDecl::lookupInheritedClass(const IdentifierInfo *ICName) const {
   // FIXME: Should make sure no callers ever do this.
   if (!hasDefinition())
 return nullptr;
@@ -657,7 +657,7 @@
   if (data().ExternallyCompleted)
 LoadExternalDefinition();
 
-  ObjCInterfaceDecl* ClassDecl = this;
+  auto *ClassDecl = this;
   while (ClassDecl != nullptr) {
 if (ClassDecl->getIdentifier() == ICName)
   return ClassDecl;
Index: include/clang/AST/DeclObjC.h
===
--- include/clang/AST/DeclObjC.h
+++ include/clang/AST/DeclObjC.h
@@ -1852,7 +1852,8 @@
 return lookupMethod(Sel, false/*isInstance*/);
   }
 
-  ObjCInterfaceDecl *lookupInheritedClass(const IdentifierInfo *ICName);
+  const ObjCInterfaceDecl *
+  lookupInheritedClass(const IdentifierInfo *ICName) const;
 
   /// Lookup a method in the classes implementation hierarchy.
   ObjCMethodDecl *lookupPrivateMethod(const Selector ,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits