diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-04-03 23:06:26 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-04-03 23:06:26 +0000 |
commit | 151976694a8e63bb6ff5e280d77371a9490b9413 (patch) | |
tree | c6cba7c16dcc09bedff10266bba0c3f186ccae1f /clang/test/Modules | |
parent | 54dc7fdefb05ce04e7864335e231c4f597967b6d (diff) | |
download | bcm5719-llvm-151976694a8e63bb6ff5e280d77371a9490b9413.tar.gz bcm5719-llvm-151976694a8e63bb6ff5e280d77371a9490b9413.zip |
<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.
llvm-svn: 178711
Diffstat (limited to 'clang/test/Modules')
-rw-r--r-- | clang/test/Modules/Inputs/builtin.h | 3 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/builtin_sub.h | 4 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/module.map | 7 | ||||
-rw-r--r-- | clang/test/Modules/builtins.m | 16 |
4 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/builtin.h b/clang/test/Modules/Inputs/builtin.h new file mode 100644 index 00000000000..7be90177d19 --- /dev/null +++ b/clang/test/Modules/Inputs/builtin.h @@ -0,0 +1,3 @@ +int i; +int *p = &i; + diff --git a/clang/test/Modules/Inputs/builtin_sub.h b/clang/test/Modules/Inputs/builtin_sub.h new file mode 100644 index 00000000000..79e3c033259 --- /dev/null +++ b/clang/test/Modules/Inputs/builtin_sub.h @@ -0,0 +1,4 @@ +int getBos1(void) { + return __builtin_object_size(p, 0); +} + diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map index 93ba4935ffd..595e5d88468 100644 --- a/clang/test/Modules/Inputs/module.map +++ b/clang/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/clang/test/Modules/builtins.m b/clang/test/Modules/builtins.m new file mode 100644 index 00000000000..40b4f9c7439 --- /dev/null +++ b/clang/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 |