Skip to content

Commit 4112759

Browse files
committed
fix invalid fixit for correctly defined function
1 parent 5994fc0 commit 4112759

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

clang-tools-extra/clang-tidy/misc/ShadowedNamespaceFunctionCheck.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ void ShadowedNamespaceFunctionCheck::check(
6969
if (!ShadowedFunc || !ShadowedNamespace)
7070
return;
7171

72+
if (ShadowedFunc->getDefinition())
73+
return;
74+
7275
// Generate warning message
7376
std::string NamespaceName = ShadowedNamespace->getQualifiedNameAsString();
7477
auto Diag = diag(Func->getLocation(),
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %check_clang_tidy %s misc-shadowed-namespace-function %t
2+
3+
void f1();
4+
namespace foo {
5+
void f0() {}
6+
void f1() {}
7+
}
8+
void f0() {}
9+
void f1() {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %check_clang_tidy %s misc-shadowed-namespace-function %t
2+
3+
void f1();
4+
namespace foo {
5+
void f0();
6+
void f1();
7+
}
8+
void foo::f0() {}
9+
void foo::f1() {}
10+
void f0() {}
11+
void f1() {}

0 commit comments

Comments
 (0)