diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-13 03:52:13 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-13 03:52:13 +0000 |
commit | 26210db67f218f46fa8ca1e1db3ba5dbbece0e84 (patch) | |
tree | e4111c2536ff9279f5400f7558c4652172b6e3c3 /clang/test | |
parent | 4f82366759235f66f21b049d4350f7e5526680d9 (diff) | |
download | bcm5719-llvm-26210db67f218f46fa8ca1e1db3ba5dbbece0e84.tar.gz bcm5719-llvm-26210db67f218f46fa8ca1e1db3ba5dbbece0e84.zip |
[modules] Follow the C++ standard's rule for linkage of enumerators: they have
the linkage of the enumeration. For enumerators of unnamed enumerations, extend
the -Wmodules-ambiguous-internal-linkage extension to allow selecting an
arbitrary enumerator (but only if they all have the same value, otherwise it's
ambiguous).
llvm-svn: 253010
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Index/linkage.c | 2 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/no-linkage/decls.h | 1 | ||||
-rw-r--r-- | clang/test/Modules/no-linkage.cpp | 4 | ||||
-rw-r--r-- | clang/test/Modules/submodules-merge-defs.cpp | 8 |
4 files changed, 9 insertions, 6 deletions
diff --git a/clang/test/Index/linkage.c b/clang/test/Index/linkage.c index b0dcb30990a..ab006590b61 100644 --- a/clang/test/Index/linkage.c +++ b/clang/test/Index/linkage.c @@ -20,7 +20,7 @@ void f16(void) { // CHECK: EnumDecl=Baz:3:6 (Definition)linkage=External -// CHECK: EnumConstantDecl=Qux:3:12 (Definition)linkage=NoLinkage +// CHECK: EnumConstantDecl=Qux:3:12 (Definition)linkage=External // CHECK: VarDecl=x:4:5linkage=External // CHECK: FunctionDecl=foo:5:6linkage=External // CHECK: VarDecl=w:6:12linkage=Internal diff --git a/clang/test/Modules/Inputs/no-linkage/decls.h b/clang/test/Modules/Inputs/no-linkage/decls.h index 5c29044abf8..9e18e10ce99 100644 --- a/clang/test/Modules/Inputs/no-linkage/decls.h +++ b/clang/test/Modules/Inputs/no-linkage/decls.h @@ -2,5 +2,4 @@ namespace RealNS { int UsingDecl; } namespace NS = RealNS; typedef int Typedef; using AliasDecl = int; -enum Enum { Enumerator }; using RealNS::UsingDecl; diff --git a/clang/test/Modules/no-linkage.cpp b/clang/test/Modules/no-linkage.cpp index 0cc808b6331..d4a9eaba403 100644 --- a/clang/test/Modules/no-linkage.cpp +++ b/clang/test/Modules/no-linkage.cpp @@ -6,21 +6,18 @@ namespace NS { int n; } // expected-note {{candidate}} struct Typedef { int n; }; // expected-note {{candidate}} int AliasDecl; // expected-note {{candidate}} -enum AlsoAnEnum { Enumerator }; // expected-note {{candidate}} int UsingDecl; // expected-note {{candidate}} // expected-note@decls.h:2 {{candidate}} // expected-note@decls.h:3 {{candidate}} // expected-note@decls.h:4 {{candidate}} // expected-note@decls.h:5 {{candidate}} -// expected-note@decls.h:6 {{candidate}} void use(int); void use_things() { use(Typedef().n); use(NS::n); use(AliasDecl); - use(Enumerator); use(UsingDecl); } @@ -30,6 +27,5 @@ void use_things_again() { use(Typedef().n); // expected-error {{ambiguous}} use(NS::n); // expected-error {{ambiguous}} use(AliasDecl); // expected-error {{ambiguous}} - use(Enumerator); // expected-error {{ambiguous}} use(UsingDecl); // expected-error {{ambiguous}} } diff --git a/clang/test/Modules/submodules-merge-defs.cpp b/clang/test/Modules/submodules-merge-defs.cpp index 361f05b553e..12e3cadd531 100644 --- a/clang/test/Modules/submodules-merge-defs.cpp +++ b/clang/test/Modules/submodules-merge-defs.cpp @@ -116,4 +116,12 @@ void use_static_inline() { StaticInline::g({}); } // expected-note@defs.h:71 {{declared here in module 'redef'}} // expected-note@defs.h:71 {{declared here in module 'stuff.use'}} #endif +int use_anon_enum = G::g; +#ifdef EARLY_INDIRECT_INCLUDE +// expected-warning@-2 3{{ambiguous use of internal linkage declaration 'g' defined in multiple modules}} +// FIXME: These notes are produced, but -verify can't match them? +// FIXME-note@defs.h:51 3{{declared here in module 'redef'}} +// FIXME-note@defs.h:51 3{{declared here in module 'stuff.use'}} +#endif +int use_named_enum = G::i; #endif |