Skip to content

Commit 02f230a

Browse files
author
Tom James
committed
Improve diagnostics
1 parent 97d068c commit 02f230a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

clang-tools-extra/clang-tidy/bugprone/MethodHidingCheck.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ void MethodHidingCheck::check(const MatchFinder::MatchResult &Result) {
118118
if (!ShadowingMethod || !DerivedClass || !BaseMethod)
119119
llvm_unreachable("Required binding not found");
120120

121-
diag(ShadowingMethod->getBeginLoc(),
122-
"'" + ShadowingMethod->getQualifiedNameAsString() +
123-
"' hides same method in '" +
124-
BaseMethod->getParent()->getNameAsString() + "'");
125-
diag(BaseMethod->getBeginLoc(), "previous definition is here",
126-
DiagnosticIDs::Note);
121+
diag(ShadowingMethod->getBeginLoc(), "'%0' hides same method in '%1'")
122+
<< ShadowingMethod->getQualifiedNameAsString()
123+
<< BaseMethod->getParent()->getNameAsString();
124+
diag(BaseMethod->getBeginLoc(), "previous definition of '%0' is here",
125+
DiagnosticIDs::Note)
126+
<< ShadowingMethod->getNameAsString();
127127
}
128128

129129
} // namespace clang::tidy::bugprone

0 commit comments

Comments
 (0)