File tree Expand file tree Collapse file tree 6 files changed +48
-2
lines changed Expand file tree Collapse file tree 6 files changed +48
-2
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ void ShadowedNamespaceFunctionCheck::check(
7070 return ;
7171
7272 // Generate warning message
73- std::string NamespaceName = ShadowedNamespace->getNameAsString ();
73+ std::string NamespaceName = ShadowedNamespace->getQualifiedNameAsString ();
7474 auto Diag = diag (Func->getLocation (),
7575 " free function %0 shadows '%1::%2'" )
7676 << Func->getDeclName ()
Original file line number Diff line number Diff line change @@ -43,4 +43,3 @@ Limitations
4343- Does not warn about template functions
4444- Does not warn about static functions or member functions
4545- Does not warn about the ``main `` function
46- - Only considers functions declared before the global definition
Original file line number Diff line number Diff line change 1+ // RUN: %check_clang_tidy %s misc-shadowed-namespace-function %t
2+
3+ namespace { void f1 (); }
4+ namespace foo {
5+ void f0 ();
6+ void f1 ();
7+ }
8+ namespace {
9+ void f0 () {}
10+ void f1 () {}
11+ }
Original file line number Diff line number Diff line change 1+ // RUN: %check_clang_tidy %s misc-shadowed-namespace-function %t
2+
3+ void f1 ();
4+ namespace foo ::foo2::foo3 {
5+ void f0 ();
6+ void f1 ();
7+ }
8+ void f0 () {}
9+ // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: free function 'f0' shadows 'foo::foo2::foo3::f0' [misc-shadowed-namespace-function]
10+ // CHECK-FIXES: void foo::foo2::foo3::f0() {}
11+ void f1 () {}
12+ // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: free function 'f1' shadows 'foo::foo2::foo3::f1' [misc-shadowed-namespace-function]
13+ // CHECK-MESSAGES-NOT: :[[@LINE-2]]:{{.*}}: note: FIX-IT applied suggested code changes
Original file line number Diff line number Diff line change 1+ // RUN: %check_clang_tidy %s misc-shadowed-namespace-function %t
2+
3+ static void f1 ();
4+ namespace foo {
5+ void f0 ();
6+ void f1 ();
7+ }
8+ static void f0 () {}
9+ static void f1 () {}
Original file line number Diff line number Diff line change 1+ // RUN: %check_clang_tidy %s misc-shadowed-namespace-function %t
2+
3+ template <typename T>
4+ void f1 ();
5+ namespace foo {
6+ template <typename T>
7+ void f0 ();
8+ template <typename T>
9+ void f1 ();
10+ }
11+ template <typename T>
12+ void f0 () {}
13+ template <typename T>
14+ void f1 () {}
You can’t perform that action at this time.
0 commit comments