1 // RUN: %clang_cc1 -fmodules %s -verify
2 // expected-no-diagnostics
4 #pragma clang module build A
6 #pragma clang module contents
7 #pragma clang module begin A
8 namespace N
{ class X
; }
9 #pragma clang module end
10 #pragma clang module endbuild
12 #pragma clang module build B
14 #pragma clang module contents
15 #pragma clang module begin B
16 namespace N
{ class Friendly
{ friend class X
; }; }
17 #pragma clang module end
18 #pragma clang module endbuild
20 #pragma clang module build C
22 #pragma clang module contents
23 #pragma clang module begin C
24 #pragma clang module import A
26 #pragma clang module import B
27 // UsingShadowDecl names the friend declaration
29 #pragma clang module end
30 #pragma clang module endbuild
32 #pragma clang module import B
33 namespace N
{ class AlsoFriendly
{ friend class X
; }; }
34 #pragma clang module import A
35 #pragma clang module import C
36 // The friend declaration from N::Friendly is now the first in the redecl
37 // chain, so is not ordinarily visible. We need the IDNS of the UsingShadowDecl
38 // to still consider it to be visible, though.