diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-07-29 23:38:25 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-07-29 23:38:25 +0000 |
commit | 826711d456bfde995ca5b08aecec88775f55b01d (patch) | |
tree | 003b8eee66e6e7885f71ec2e880df732fbd53a26 /clang/test/Modules | |
parent | 5f6d160b5b577ee15a393df12662999ac56c2c1f (diff) | |
download | bcm5719-llvm-826711d456bfde995ca5b08aecec88775f55b01d.tar.gz bcm5719-llvm-826711d456bfde995ca5b08aecec88775f55b01d.zip |
[modules] When performing redeclaration lookup for a using declaration, prefer
UsingShadowDecls over other declarations of the same entity in the lookup
results. This ensures that we build correct redeclaration chains for the
UsingShadowDecls (otherwise we could see assertions and other misbehavior in
modules builds, when merging combines multiple redeclaration chains for the
same entity from the same module into one chain).
llvm-svn: 243592
Diffstat (limited to 'clang/test/Modules')
6 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/submodules-merge-defs/defs.h b/clang/test/Modules/Inputs/submodules-merge-defs/defs.h index 07dfac7ee65..e4c86d80ba6 100644 --- a/clang/test/Modules/Inputs/submodules-merge-defs/defs.h +++ b/clang/test/Modules/Inputs/submodules-merge-defs/defs.h @@ -97,3 +97,9 @@ namespace MergeFunctionTemplateSpecializations { enum ScopedEnum : int; enum ScopedEnum : int { a, b, c }; + +namespace RedeclDifferentDeclKind { + struct X {}; + typedef X X; + using RedeclDifferentDeclKind::X; +} diff --git a/clang/test/Modules/Inputs/using-decl-redecl/a.h b/clang/test/Modules/Inputs/using-decl-redecl/a.h new file mode 100644 index 00000000000..477546945c0 --- /dev/null +++ b/clang/test/Modules/Inputs/using-decl-redecl/a.h @@ -0,0 +1,2 @@ +struct string {}; +namespace N { typedef ::string clstring; } diff --git a/clang/test/Modules/Inputs/using-decl-redecl/b.h b/clang/test/Modules/Inputs/using-decl-redecl/b.h new file mode 100644 index 00000000000..0714bb99141 --- /dev/null +++ b/clang/test/Modules/Inputs/using-decl-redecl/b.h @@ -0,0 +1,3 @@ +#include "a.h" +namespace N { using ::N::clstring; } +extern N::clstring b; diff --git a/clang/test/Modules/Inputs/using-decl-redecl/c.h b/clang/test/Modules/Inputs/using-decl-redecl/c.h new file mode 100644 index 00000000000..e44e1a04e05 --- /dev/null +++ b/clang/test/Modules/Inputs/using-decl-redecl/c.h @@ -0,0 +1,2 @@ +#include "b.h" +namespace N { using ::N::clstring; } diff --git a/clang/test/Modules/Inputs/using-decl-redecl/module.modulemap b/clang/test/Modules/Inputs/using-decl-redecl/module.modulemap new file mode 100644 index 00000000000..bd6ea830c2d --- /dev/null +++ b/clang/test/Modules/Inputs/using-decl-redecl/module.modulemap @@ -0,0 +1,3 @@ +module a { header "a.h" } +module b { header "b.h" export * } +module c { header "c.h" export * } diff --git a/clang/test/Modules/using-decl-redecl.cpp b/clang/test/Modules/using-decl-redecl.cpp new file mode 100644 index 00000000000..0e78cec1188 --- /dev/null +++ b/clang/test/Modules/using-decl-redecl.cpp @@ -0,0 +1,11 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t \ +// RUN: -fmodule-map-file=%S/Inputs/using-decl-redecl/module.modulemap \ +// RUN: -I%S/Inputs/using-decl-redecl \ +// RUN: -verify %s +#include "c.h" +N::clstring y = b; + +// Use a typo to trigger import of all declarations in N. +N::clstrinh s; // expected-error {{did you mean 'clstring'}} +// expected-note@a.h:2 {{here}} |