Clang Project

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