diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-06 01:07:05 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-06 01:07:05 +0000 |
commit | a263c346e568e15dde95ad2d1417444c5cda134f (patch) | |
tree | 5033028c647c91413c416e61e51382bf8202e149 /clang/test/Modules/using-decl-friend-2.cpp | |
parent | 0f74d273b009240bd71c10e8e5487f0add521048 (diff) | |
download | bcm5719-llvm-a263c346e568e15dde95ad2d1417444c5cda134f.tar.gz bcm5719-llvm-a263c346e568e15dde95ad2d1417444c5cda134f.zip |
Serialize the IDNS for a UsingShadowDecl rather than recomputing it.
Attempting to recompute it are doomed to fail because the IDNS of a declaration
is not necessarily preserved across serialization and deserialization (in turn
because whether a friend declaration is visible depends on whether some prior
non-friend declaration exists).
llvm-svn: 321921
Diffstat (limited to 'clang/test/Modules/using-decl-friend-2.cpp')
-rw-r--r-- | clang/test/Modules/using-decl-friend-2.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/clang/test/Modules/using-decl-friend-2.cpp b/clang/test/Modules/using-decl-friend-2.cpp new file mode 100644 index 00000000000..0c71c37765f --- /dev/null +++ b/clang/test/Modules/using-decl-friend-2.cpp @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -fmodules %s -verify +// expected-no-diagnostics + +#pragma clang module build A +module A {} +#pragma clang module contents +#pragma clang module begin A +namespace N { class X; } +#pragma clang module end +#pragma clang module endbuild + +#pragma clang module build B +module B {} +#pragma clang module contents +#pragma clang module begin B +namespace N { class Friendly { friend class X; }; } +#pragma clang module end +#pragma clang module endbuild + +#pragma clang module build C +module C {} +#pragma clang module contents +#pragma clang module begin C +#pragma clang module import A +void use_X(N::X *p); +#pragma clang module import B +// UsingShadowDecl names the friend declaration +using N::X; +#pragma clang module end +#pragma clang module endbuild + +#pragma clang module import B +namespace N { class AlsoFriendly { friend class X; }; } +#pragma clang module import A +#pragma clang module import C +// The friend declaration from N::Friendly is now the first in the redecl +// chain, so is not ordinarily visible. We need the IDNS of the UsingShadowDecl +// to still consider it to be visible, though. +X *p; |