1 | // RUN: clang-tidy %s -checks='-*,google-build-namespaces,google-build-using-namespace' -header-filter='.*' -- | FileCheck %s -implicit-check-not="{{warning|error}}:" |
2 | #include "Inputs/google-namespaces.h" |
3 | // CHECK: warning: do not use unnamed namespaces in header files [google-build-namespaces] |
4 | |
5 | using namespace spaaaace; |
6 | // CHECK: :[[@LINE-1]]:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace] |
7 | |
8 | using spaaaace::core; // no-warning |
9 | |
10 | namespace std { |
11 | inline namespace literals { |
12 | inline namespace chrono_literals { |
13 | } |
14 | inline namespace complex_literals { |
15 | } |
16 | inline namespace string_literals { |
17 | } |
18 | } |
19 | } |
20 | |
21 | using namespace std::chrono_literals; // no-warning |
22 | using namespace std::complex_literals; // no-warning |
23 | using namespace std::literals; // no-warning |
24 | using namespace std::literals::chrono_literals; // no-warning |
25 | using namespace std::literals::complex_literals; // no-warning |
26 | using namespace std::literals::string_literals; // no-warning |
27 | using namespace std::string_literals; // no-warning |
28 | |
29 | namespace literals {} |
30 | |
31 | using namespace literals; |
32 | // CHECK: :[[@LINE-1]]:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace] |
33 | |
34 | namespace foo { |
35 | inline namespace literals { |
36 | inline namespace bar_literals {} |
37 | } |
38 | } |
39 | |
40 | using namespace foo::literals; |
41 | // CHECK: :[[@LINE-1]]:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace] |
42 | |
43 | using namespace foo::bar_literals; |
44 | // CHECK: :[[@LINE-1]]:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace] |
45 | |
46 | using namespace foo::literals::bar_literals; |
47 | // CHECK: :[[@LINE-1]]:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace] |
48 | |
49 | namespace foo_literals {} |
50 | |
51 | using namespace foo_literals; |
52 | // CHECK: :[[@LINE-1]]:1: warning: do not use namespace using-directives; use using-declarations instead [google-build-using-namespace] |
53 | |