diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-02-11 18:16:18 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-02-11 18:16:18 +0000 |
commit | f4e955b694be22926f5ceb41e55d319ce9ff4aab (patch) | |
tree | 7457b19c8da2c8254bc1feebdf4e668babe35266 /test/Modules | |
parent | c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591a (diff) |
[Modules] Cope better with top-level declarations loaded after being declared in the current translation unit <rdar://problem/13189985>.
These two related tweaks to keep the information associated with a
given identifier correct when the identifier has been given some
top-level information (say, a top-level declaration) and more
information is then loaded from a module. The first ensures that an
identifier that was "interesting" before being loaded from an AST is
considered to be different from its on-disk counterpart. Otherwise, we
lose such changes when writing the current translation unit as a
module.
Second, teach the code that injects AST-loaded names into the
identifier chain for name lookup to keep the most recent declaration,
so that we don't end up confusing our declaration chains by having a
different declaration in there.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174895 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules')
-rw-r--r-- | test/Modules/Inputs/module.map | 4 | ||||
-rw-r--r-- | test/Modules/Inputs/redecl-merge-bottom-prefix.h | 4 | ||||
-rw-r--r-- | test/Modules/Inputs/redecl-merge-bottom.h | 5 | ||||
-rw-r--r-- | test/Modules/Inputs/redecl-merge-left.h | 8 | ||||
-rw-r--r-- | test/Modules/redecl-merge2.m | 8 |
5 files changed, 29 insertions, 0 deletions
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index 2e6ef088d4..eeb8d158e5 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -86,6 +86,10 @@ module redecl_merge_right { export * } module redecl_merge_bottom { + explicit module prefix { + header "redecl-merge-bottom-prefix.h" + } + header "redecl-merge-bottom.h" export * } diff --git a/test/Modules/Inputs/redecl-merge-bottom-prefix.h b/test/Modules/Inputs/redecl-merge-bottom-prefix.h new file mode 100644 index 0000000000..6501e1b65b --- /dev/null +++ b/test/Modules/Inputs/redecl-merge-bottom-prefix.h @@ -0,0 +1,4 @@ +// A class that is declared in the 'bottom' module, then loaded from +// one of the modules it depends on. It needs to be visible when this +// module is loaded. +@class DeclaredThenLoaded; diff --git a/test/Modules/Inputs/redecl-merge-bottom.h b/test/Modules/Inputs/redecl-merge-bottom.h index 28ea20c55d..b8fb1794af 100644 --- a/test/Modules/Inputs/redecl-merge-bottom.h +++ b/test/Modules/Inputs/redecl-merge-bottom.h @@ -18,3 +18,8 @@ struct S3; void refers_to_C4(C4*); +@interface UnrelatedToDeclaredThenLoaded +- declaredThenLoadedMethod; +@end + +@class DeclaredThenLoaded; diff --git a/test/Modules/Inputs/redecl-merge-left.h b/test/Modules/Inputs/redecl-merge-left.h index 973d594a30..cf07165a26 100644 --- a/test/Modules/Inputs/redecl-merge-left.h +++ b/test/Modules/Inputs/redecl-merge-left.h @@ -82,3 +82,11 @@ extern double var3; // top level. typedef void funcptr_with_id(int id); +// A class that is declared in the 'bottom' module, then loaded from +// one of the modules it depends on. +@interface DeclaredThenLoaded +- declaredThenLoadedMethod; +@end + +@class DeclaredThenLoaded; + diff --git a/test/Modules/redecl-merge2.m b/test/Modules/redecl-merge2.m new file mode 100644 index 0000000000..3431ecc90b --- /dev/null +++ b/test/Modules/redecl-merge2.m @@ -0,0 +1,8 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class +// expected-no-diagnostics + +@import redecl_merge_bottom.prefix; + +DeclaredThenLoaded *dtl; + |