xref: /aosp_15_r20/external/clang/test/PCH/cxx-namespaces.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // Test this without pch.
2*67e74705SXin Li // RUN: %clang_cc1 -include %S/cxx-namespaces.h -fsyntax-only -verify %s
3*67e74705SXin Li 
4*67e74705SXin Li // Test with pch.
5*67e74705SXin Li // RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-namespaces.h
6*67e74705SXin Li // RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
7*67e74705SXin Li // RUN: %clang_cc1 -include-pch %t -fsyntax-only -ast-dump-lookups -ast-dump-filter N %s | FileCheck %s
8*67e74705SXin Li 
9*67e74705SXin Li // Test with modules.
10*67e74705SXin Li // RUN: %clang_cc1 -fmodules -x c++-header -emit-pch -o %t %S/cxx-namespaces.h
11*67e74705SXin Li // RUN: %clang_cc1 -fmodules -include-pch %t -fsyntax-only -verify %s
12*67e74705SXin Li // RUN: %clang_cc1 -fmodules -include-pch %t -fsyntax-only -ast-dump-lookups -ast-dump-filter N %s | FileCheck %s
13*67e74705SXin Li 
14*67e74705SXin Li // expected-no-diagnostics
15*67e74705SXin Li 
m()16*67e74705SXin Li void m() {
17*67e74705SXin Li   N::x = 0;
18*67e74705SXin Li   N::f();
19*67e74705SXin Li }
20*67e74705SXin Li 
21*67e74705SXin Li // namespace 'N' should contain only two declarations of 'f'.
22*67e74705SXin Li 
23*67e74705SXin Li // CHECK:      DeclarationName 'f'
24*67e74705SXin Li // CHECK-NEXT: |-Function {{.*}} 'f' 'void (
25*67e74705SXin Li // CHECK-NEXT: `-Function {{.*}} 'f' 'void (
26