aboutsummaryrefslogtreecommitdiff
path: root/test/Modules
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-04-03 23:06:26 +0000
committerDouglas Gregor <dgregor@apple.com>2013-04-03 23:06:26 +0000
commit96df3562752e13237df051469271f8999ad60fe6 (patch)
tree06ccb2f94fe625a5d5822b2618f01d806c0f25cb /test/Modules
parent5b8d0af4234252b38229a5bae1d615ac9769f73f (diff)
<rdar://problem/13560075> Teach name lookup for builtin names to find hidden declarations.
Normal name lookup ignores any hidden declarations. When name lookup for builtin declarations fails, we just synthesize a new declaration at the point of use. With modules, this could lead to multiple declarations of the same builtin, if one came from a (hidden) submodule that was later made visible. Teach name lookup to always find builtin names, so we don't create these redundant declarations in the first place. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178711 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules')
-rw-r--r--test/Modules/Inputs/builtin.h3
-rw-r--r--test/Modules/Inputs/builtin_sub.h4
-rw-r--r--test/Modules/Inputs/module.map7
-rw-r--r--test/Modules/builtins.m16
4 files changed, 30 insertions, 0 deletions
diff --git a/test/Modules/Inputs/builtin.h b/test/Modules/Inputs/builtin.h
new file mode 100644
index 0000000000..7be90177d1
--- /dev/null
+++ b/test/Modules/Inputs/builtin.h
@@ -0,0 +1,3 @@
+int i;
+int *p = &i;
+
diff --git a/test/Modules/Inputs/builtin_sub.h b/test/Modules/Inputs/builtin_sub.h
new file mode 100644
index 0000000000..79e3c03325
--- /dev/null
+++ b/test/Modules/Inputs/builtin_sub.h
@@ -0,0 +1,4 @@
+int getBos1(void) {
+ return __builtin_object_size(p, 0);
+}
+
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index 93ba4935ff..595e5d8846 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -192,3 +192,10 @@ module config {
module diag_pragma {
header "diag_pragma.h"
}
+
+module builtin {
+ header "builtin.h"
+ explicit module sub {
+ header "builtin_sub.h"
+ }
+}
diff --git a/test/Modules/builtins.m b/test/Modules/builtins.m
new file mode 100644
index 0000000000..40b4f9c743
--- /dev/null
+++ b/test/Modules/builtins.m
@@ -0,0 +1,16 @@
+@import builtin;
+
+int foo() {
+ return __builtin_object_size(p, 0);
+}
+
+@import builtin.sub;
+
+int bar() {
+ return __builtin_object_size(p, 0);
+}
+
+
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -I %S/Inputs %s -verify
+// expected-no-diagnostics