xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/chain-late-anonymous-namespace.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // no PCH
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -include %s -include %s -fsyntax-only %s
3*f4a2713aSLionel Sambuc // with PCH
4*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -chain-include %s -chain-include %s -fsyntax-only %s
5*f4a2713aSLionel Sambuc // with PCH, with modules enabled
6*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -chain-include %s -chain-include %s -fsyntax-only -fmodules %s
7*f4a2713aSLionel Sambuc #if !defined(PASS1)
8*f4a2713aSLionel Sambuc #define PASS1
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc namespace ns {}
11*f4a2713aSLionel Sambuc namespace os {}
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc #elif !defined(PASS2)
14*f4a2713aSLionel Sambuc #define PASS2
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc namespace ns {
17*f4a2713aSLionel Sambuc   namespace {
18*f4a2713aSLionel Sambuc     extern int x;
19*f4a2713aSLionel Sambuc   }
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc namespace {
23*f4a2713aSLionel Sambuc   extern int y;
24*f4a2713aSLionel Sambuc }
25*f4a2713aSLionel Sambuc namespace {
26*f4a2713aSLionel Sambuc }
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc namespace os {
29*f4a2713aSLionel Sambuc   extern "C" {
30*f4a2713aSLionel Sambuc     namespace {
31*f4a2713aSLionel Sambuc       extern int z;
32*f4a2713aSLionel Sambuc     }
33*f4a2713aSLionel Sambuc   }
34*f4a2713aSLionel Sambuc }
35*f4a2713aSLionel Sambuc 
36*f4a2713aSLionel Sambuc #else
37*f4a2713aSLionel Sambuc 
38*f4a2713aSLionel Sambuc namespace ns {
39*f4a2713aSLionel Sambuc   namespace {
40*f4a2713aSLionel Sambuc     int x;
41*f4a2713aSLionel Sambuc   }
test()42*f4a2713aSLionel Sambuc   void test() {
43*f4a2713aSLionel Sambuc     (void)x;
44*f4a2713aSLionel Sambuc   }
45*f4a2713aSLionel Sambuc }
46*f4a2713aSLionel Sambuc 
47*f4a2713aSLionel Sambuc namespace {
48*f4a2713aSLionel Sambuc   int y;
49*f4a2713aSLionel Sambuc }
test()50*f4a2713aSLionel Sambuc void test() {
51*f4a2713aSLionel Sambuc   (void)y;
52*f4a2713aSLionel Sambuc }
53*f4a2713aSLionel Sambuc 
54*f4a2713aSLionel Sambuc namespace os {
55*f4a2713aSLionel Sambuc   namespace {
56*f4a2713aSLionel Sambuc     int z;
57*f4a2713aSLionel Sambuc   }
test()58*f4a2713aSLionel Sambuc   void test() {
59*f4a2713aSLionel Sambuc     (void)z;
60*f4a2713aSLionel Sambuc   }
61*f4a2713aSLionel Sambuc }
62*f4a2713aSLionel Sambuc 
63*f4a2713aSLionel Sambuc #endif
64