void Sema::AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl,
bool instance) {
+ if (ExternalSource)
+ ReadMethodPool(Method->getSelector());
+
GlobalMethodPool::iterator Pos = MethodPool.find(Method->getSelector());
- if (Pos == MethodPool.end()) {
- if (ExternalSource) {
- ReadMethodPool(Method->getSelector());
- Pos = MethodPool.find(Method->getSelector());
- }
-
- if (Pos == MethodPool.end())
- Pos = MethodPool.insert(std::make_pair(Method->getSelector(),
- GlobalMethods())).first;
- }
+ if (Pos == MethodPool.end())
+ Pos = MethodPool.insert(std::make_pair(Method->getSelector(),
+ GlobalMethods())).first;
Method->setDefined(impl);
ObjCMethodDecl *Sema::LookupMethodInGlobalPool(Selector Sel, SourceRange R,
bool receiverIdOrClass,
bool warn, bool instance) {
+ if (ExternalSource)
+ ReadMethodPool(Sel);
+
GlobalMethodPool::iterator Pos = MethodPool.find(Sel);
- if (Pos == MethodPool.end()) {
- if (ExternalSource) {
- ReadMethodPool(Sel);
-
- Pos = MethodPool.find(Sel);
- if (Pos == MethodPool.end())
- return 0;
-
- } else
- return 0;
- }
+ if (Pos == MethodPool.end())
+ return 0;
ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second;
--- /dev/null
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodule-cache-path %t -fmodules -I %S/Inputs %s -verify
+
+@import MethodPoolA;
+
+
+// in other file: // expected-note{{using}}
+
+
+
+
+// in other file: expected-note{{also found}}
+
+void testMethod1(id object) {
+ [object method1];
+}
+
+void testMethod2(id object) {
+ [object method2:1];
+}
+
+@import MethodPoolB;
+
+void testMethod1Again(id object) {
+ [object method1];
+}
+
+void testMethod2Again(id object) {
+ [object method2:1]; // expected-warning{{multiple methods named 'method2:' found}}
+}