[cfe-commits] r66016 - /cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Chris Lattner
sabre at nondot.org
Tue Mar 3 21:16:46 PST 2009
Author: lattner
Date: Tue Mar 3 23:16:45 2009
New Revision: 66016
URL: http://llvm.org/viewvc/llvm-project?rev=66016&view=rev
Log:
simplify Sema::AddInstanceMethodToGlobalPool, no functionality change.
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=66016&r1=66015&r2=66016&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Mar 3 23:16:45 2009
@@ -1032,25 +1032,23 @@
}
void Sema::AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method) {
- ObjCMethodList &FirstMethod = InstanceMethodPool[Method->getSelector()];
- if (!FirstMethod.Method) {
+ ObjCMethodList &Entry = InstanceMethodPool[Method->getSelector()];
+ if (Entry.Method == 0) {
// Haven't seen a method with this selector name yet - add it.
- FirstMethod.Method = Method;
- FirstMethod.Next = 0;
- } else {
- // We've seen a method with this name, now check the type signature(s).
- bool match = MatchTwoMethodDeclarations(Method, FirstMethod.Method);
-
- for (ObjCMethodList *Next = FirstMethod.Next; !match && Next;
- Next = Next->Next)
- match = MatchTwoMethodDeclarations(Method, Next->Method);
-
- if (!match) {
- // We have a new signature for an existing method - add it.
- // This is extremely rare. Only 1% of Cocoa selectors are "overloaded".
- FirstMethod.Next = new ObjCMethodList(Method, FirstMethod.Next);;
- }
+ Entry.Method = Method;
+ Entry.Next = 0;
+ return;
}
+
+ // We've seen a method with this name, see if we have already seen this type
+ // signature.
+ for (ObjCMethodList *List = &Entry; List; List = List->Next)
+ if (MatchTwoMethodDeclarations(Method, List->Method))
+ return;
+
+ // We have a new signature for an existing method - add it.
+ // This is extremely rare. Only 1% of Cocoa selectors are "overloaded".
+ Entry.Next = new ObjCMethodList(Method, Entry.Next);
}
// FIXME: Finish implementing -Wno-strict-selector-match.
More information about the cfe-commits
mailing list