diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-12 22:19:45 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-12 22:19:45 +0000 |
commit | 97135cc94a8fcc1ec9b04e4db4ef08c18081b8be (patch) | |
tree | 5fb465525229cfc753453ed288944b51aeb9196b /clang/test/Modules/submodules-merge-defs.cpp | |
parent | 990668b7d00e598f110eff510ca4681b4211d47f (diff) | |
download | bcm5719-llvm-97135cc94a8fcc1ec9b04e4db4ef08c18081b8be.tar.gz bcm5719-llvm-97135cc94a8fcc1ec9b04e4db4ef08c18081b8be.zip |
[modules] Simplify and generalize the existing rule for finding hidden
declarations in redeclaration lookup. A declaration is now visible to
lookup if:
* It is visible (not in a module, or in an imported module), or
* We're doing redeclaration lookup and it's externally-visible, or
* We're doing typo correction and looking for unimported decls.
We now support multiple modules having different internal-linkage or no-linkage
definitions of the same name for all entities, not just for functions,
variables, and some typedefs. As previously, if multiple such entities are
visible, any attempt to use them will result in an ambiguity error.
This patch fixes the linkage calculation for a number of entities where we
previously didn't need to get it right (using-declarations, namespace aliases,
and so on). It also classifies enumerators as always having no linkage, which
is a slight deviation from the C++ standard's definition, but not an observable
change outside modules (this change is being discussed on the -core reflector
currently).
This also removes the prior special case for tag lookup, which made some cases
of this work, but also led to bizarre, bogus "must use 'struct' to refer to type
'Foo' in this scope" diagnostics in C++.
llvm-svn: 252960
Diffstat (limited to 'clang/test/Modules/submodules-merge-defs.cpp')
-rw-r--r-- | clang/test/Modules/submodules-merge-defs.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/clang/test/Modules/submodules-merge-defs.cpp b/clang/test/Modules/submodules-merge-defs.cpp index bb8e69367ca..361f05b553e 100644 --- a/clang/test/Modules/submodules-merge-defs.cpp +++ b/clang/test/Modules/submodules-merge-defs.cpp @@ -12,7 +12,7 @@ #include "indirect.h" #endif -A pre_a; // expected-error {{must use 'struct'}} +A pre_a; #ifdef IMPORT_USE_2 // expected-error-re@-2 {{must be imported from one of {{.*}}stuff.use{{.*}}stuff.use-2}} #elif EARLY_INDIRECT_INCLUDE @@ -21,29 +21,28 @@ A pre_a; // expected-error {{must use 'struct'}} // expected-error@-6 {{must be imported from module 'stuff.use'}} #endif // expected-note@defs.h:1 +{{here}} +extern class A pre_a2; +int pre_use_a = use_a(pre_a2); // expected-error {{'A' must be imported}} expected-error {{'use_a' must be imported}} // expected-note@defs.h:2 +{{here}} -int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} expected-error {{'use_a' must be imported}} B::Inner2 pre_bi; // expected-error +{{must be imported}} // expected-note@defs.h:4 +{{here}} // expected-note@defs.h:17 +{{here}} -void pre_bfi(B b) { // expected-error {{must use 'class'}} expected-error +{{must be imported}} - b.f<int>(); // expected-error +{{must be imported}} expected-error +{{}} - // expected-note@defs.h:19 +{{here}} +void pre_bfi(B b) { // expected-error +{{must be imported}} + b.f<int>(); // expected-error +{{}} } C_Base<1> pre_cb1; // expected-error +{{must be imported}} // expected-note@defs.h:23 +{{here}} -C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} +C1 pre_c1; // expected-error +{{must be imported}} // expected-note@defs.h:25 +{{here}} -C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} +C2 pre_c2; // expected-error +{{must be imported}} // expected-note@defs.h:26 +{{here}} D::X pre_dx; // expected-error +{{must be imported}} // expected-note@defs.h:28 +{{here}} // expected-note@defs.h:29 +{{here}} -// FIXME: We should warn that use_dx is being used without being imported. -int pre_use_dx = use_dx(pre_dx); +int pre_use_dx = use_dx(pre_dx); // ignored; pre_dx is invalid int pre_e = E(0); // expected-error {{must be imported}} // expected-note@defs.h:32 +{{here}} @@ -69,8 +68,9 @@ J<> pre_j; // expected-error {{declaration of 'J' must be imported}} #endif // expected-note@defs.h:58 +{{here}} -ScopedEnum pre_scopedenum; // expected-error {{must be imported}} expected-error {{must use 'enum'}} -// expected-note@defs.h:106 {{here}} +ScopedEnum pre_scopedenum; // expected-error {{must be imported}} +// expected-note@defs.h:105 0-1{{here}} +// expected-note@defs.h:106 0-1{{here}} enum ScopedEnum : int; ScopedEnum pre_scopedenum_declared; // ok |