summaryrefslogtreecommitdiff
path: root/test/Modules/redecl-merge.m
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-20 18:11:52 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-20 18:11:52 +0000
commit2ccd89cff3f1c18b48f649240302446a7dae28b9 (patch)
tree47e2010c301d5bfe4e20a9cfacfd21c0f04de401 /test/Modules/redecl-merge.m
parente7aa27a826f0b353713df6bfa0715818db8cde74 (diff)
downloadclang-2ccd89cff3f1c18b48f649240302446a7dae28b9.tar.gz
When performing name lookup for a redeclaration, ignore module
visibility restrictions. This ensures that all declarations of the same entity end up in the same redeclaration chain, even if some of those declarations aren't visible. While this may seem unfortunate to some---why can't two C modules have different functions named 'f'?---it's an acknowedgment that a module does not introduce a new "namespace" of names. As part of this, stop merging the 'module-private' bit from previous declarations to later declarations, because we want each declaration in a module to stand on its own because this can effect, for example, submodule visibility. Note that this notion of names that are invisible to normal name lookup but are available for redeclaration lookups is how we should implement friend declarations and extern declarations within local function scopes. I'm not tackling that problem now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146980 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules/redecl-merge.m')
-rw-r--r--test/Modules/redecl-merge.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/Modules/redecl-merge.m b/test/Modules/redecl-merge.m
index 6497268c38..7021d14f69 100644
--- a/test/Modules/redecl-merge.m
+++ b/test/Modules/redecl-merge.m
@@ -20,6 +20,18 @@ B *f1() {
@class B;
+// Test redeclarations of entities in explicit submodules, to make
+// sure we're maintaining the declaration chains even when normal name
+// lookup can't see what we're looking for.
+void testExplicit() {
+ Explicit *e;
+ int *(*fp)(void) = &explicit_func;
+ int *ip = explicit_func();
+
+ // FIXME: Should complain about definition not having been imported.
+ struct explicit_struct es = { 0 };
+}
+
__import_module__ redecl_merge_bottom;
@implementation B