File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -72,14 +72,14 @@ void ShadowedNamespaceFunctionCheck::check(
7272 // Generate warning message
7373 std::string NamespaceName = ShadowedNamespace->getNameAsString ();
7474 auto Diag = diag (Func->getLocation (),
75- " free function %0 shadows %1::%2" )
75+ " free function %0 shadows ' %1::%2' " )
7676 << Func->getDeclName ()
7777 << NamespaceName
78- << ShadowedFunc->getDeclName ();
78+ << ShadowedFunc->getDeclName (). getAsString () ;
7979
8080 // Generate fixit hint to add namespace qualification
8181 SourceLocation NameLoc = Func->getLocation ();
82- if (NameLoc.isValid ()) {
82+ if (NameLoc.isValid () && !Func-> getPreviousDecl () ) {
8383 std::string Fix = NamespaceName + " ::" ;
8484 Diag << FixItHint::CreateInsertion (NameLoc, Fix);
8585 }
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ namespace foo {
66 void f1 ();
77}
88void f0 () {}
9- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: free function 'f0' shadows foo::f0 [misc-shadowed-namespace-function]
9+ // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: free function 'f0' shadows ' foo::f0' [misc-shadowed-namespace-function]
1010// CHECK-FIXES: void foo::f0() {}
1111void f1 () {}
12- // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: free function 'f1' shadows foo::f1 [misc-shadowed-namespace-function]
12+ // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: free function 'f1' shadows ' foo::f1' [misc-shadowed-namespace-function]
1313// CHECK-MESSAGES-NOT: :[[@LINE-2]]:{{.*}}: note: FIX-IT applied suggested code changes
You can’t perform that action at this time.
0 commit comments