Method Pool in modules: we make sure that if a module contains an entry for
a selector, the entry should be complete, containing everything introduced by
that module and all modules it imports.
Before writing out the method pool of a module, we sync up the out of date
selectors by pulling in methods for the selectors, from all modules it imports.
In ReadMethodPool, after pulling in the method pool entry for module A, this
lets us skip the modules that module A imports.
rdar://problem/25900131
llvm-svn: 268091
diff --git a/clang/test/Modules/Inputs/MethodPoolCombined1.h b/clang/test/Modules/Inputs/MethodPoolCombined1.h
new file mode 100644
index 0000000..057b738
--- /dev/null
+++ b/clang/test/Modules/Inputs/MethodPoolCombined1.h
@@ -0,0 +1,6 @@
+
+@import MethodPoolString1;
+@interface A
+- (int)stringValue;
+@end
+
diff --git a/clang/test/Modules/Inputs/MethodPoolCombined2.h b/clang/test/Modules/Inputs/MethodPoolCombined2.h
new file mode 100644
index 0000000..166906e
--- /dev/null
+++ b/clang/test/Modules/Inputs/MethodPoolCombined2.h
@@ -0,0 +1 @@
+@import MethodPoolString2;
diff --git a/clang/test/Modules/Inputs/MethodPoolString1.h b/clang/test/Modules/Inputs/MethodPoolString1.h
new file mode 100644
index 0000000..c64ad95
--- /dev/null
+++ b/clang/test/Modules/Inputs/MethodPoolString1.h
@@ -0,0 +1,4 @@
+
+@interface S1
+- (int)stringValue;
+@end
diff --git a/clang/test/Modules/Inputs/MethodPoolString2.h b/clang/test/Modules/Inputs/MethodPoolString2.h
new file mode 100644
index 0000000..30e9bfb
--- /dev/null
+++ b/clang/test/Modules/Inputs/MethodPoolString2.h
@@ -0,0 +1,4 @@
+
+@interface S2
+- (int)stringValue;
+@end
diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map
index 632517d..1249387 100644
--- a/clang/test/Modules/Inputs/module.map
+++ b/clang/test/Modules/Inputs/module.map
@@ -393,3 +393,20 @@
header "elaborated-type-structs.h"
}
}
+
+// We import a module, then declare a method with selector stringValue in
+// MethodPoolCombined1.h. In MethodPoolCombined2.h, we import another module
+// that also contains a method for selector stringValue. We make sure that
+// the method pool entry for stringValue in this module is complete.
+module MethodPoolCombined {
+ header "MethodPoolCombined1.h"
+ header "MethodPoolCombined2.h"
+}
+
+module MethodPoolString1 {
+ header "MethodPoolString1.h"
+}
+
+module MethodPoolString2 {
+ header "MethodPoolString2.h"
+}
diff --git a/clang/test/Modules/method_pool_write.m b/clang/test/Modules/method_pool_write.m
new file mode 100644
index 0000000..b7f8ac6
--- /dev/null
+++ b/clang/test/Modules/method_pool_write.m
@@ -0,0 +1,11 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -fsyntax-only -I %S/Inputs %s -verify
+// expected-no-diagnostics
+
+@import MethodPoolCombined;
+@import MethodPoolString2;
+
+void message_kindof_object(__kindof S2 *kindof_S2) {
+ [kindof_S2 stringValue];
+}
+