[clang-tools-extra] 7c4782c - [clang-tidy] Fix regression in RenamerClangTidy
Nathan James via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 4 01:27:13 PDT 2020
Author: Nathan James
Date: 2020-08-04T09:27:01+01:00
New Revision: 7c4782ce91d66a8447a851362b99bb86a42b7c08
URL: https://github.com/llvm/llvm-project/commit/7c4782ce91d66a8447a851362b99bb86a42b7c08
DIFF: https://github.com/llvm/llvm-project/commit/7c4782ce91d66a8447a851362b99bb86a42b7c08.diff
LOG: [clang-tidy] Fix regression in RenamerClangTidy
See bug https://bugs.llvm.org/show_bug.cgi\?id\=46976
Added:
Modified:
clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
index 040378d980f1a..2d67ca4a16180 100644
--- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
@@ -157,6 +157,9 @@ void RenamerClangTidyCheck::addUsage(
RenamerClangTidyCheck::NamingCheckFailure &Failure =
NamingCheckFailures[Decl];
+ if (!Failure.RawUsageLocs.insert(FixLocation.getRawEncoding()).second)
+ return;
+
if (!Failure.ShouldFix())
return;
@@ -165,8 +168,6 @@ void RenamerClangTidyCheck::addUsage(
if (!utils::rangeCanBeFixed(Range, SourceMgr))
Failure.FixStatus = RenamerClangTidyCheck::ShouldFixStatus::InsideMacro;
-
- Failure.RawUsageLocs.insert(FixLocation.getRawEncoding());
}
void RenamerClangTidyCheck::addUsage(const NamedDecl *Decl, SourceRange Range,
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp
index 24c1c4270dec8..fed362bbecdec 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp
@@ -578,3 +578,8 @@ void Foo() {
#undef M1
#undef DUP
} // namespace scratchspace
+
+template<typename type_t>
+auto GetRes(type_t& Param) -> decltype(Param.res());
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: invalid case style for parameter 'Param'
+// CHECK-FIXES: auto GetRes(type_t& a_param) -> decltype(a_param.res());
More information about the cfe-commits
mailing list