[PATCH] D65065: [clang-tidy] Possibility of displaying duplicate warnings
Tibor Brunner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 5 07:17:53 PDT 2019
bruntib updated this revision to Diff 213356.
bruntib edited the summary of this revision.
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65065/new/
https://reviews.llvm.org/D65065
Files:
clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
clang-tools-extra/test/clang-tidy/duplicate-reports.cpp
Index: clang-tools-extra/test/clang-tidy/duplicate-reports.cpp
===================================================================
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/duplicate-reports.cpp
@@ -0,0 +1,19 @@
+// RUN: %check_clang_tidy %s cert-err09-cpp,cert-err61-cpp %t
+
+void alwaysThrows() {
+ int ex = 42;
+ // At this location both cert-err09-cpp and cert-err61-cpp report the
+ // message. The order of the reports is unknown, that's why the checker name
+ // is not included in the expected warning.
+
+ // CHECK-MESSAGES: warning: throw expression should throw anonymous temporary values instead
+ // CHECK-MESSAGES: warning: throw expression should throw anonymous temporary values instead
+ throw ex;
+}
+
+void doTheJob() {
+ try {
+ alwaysThrows();
+ } catch (int&) {
+ }
+}
Index: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
===================================================================
--- clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -742,8 +742,9 @@
const tooling::DiagnosticMessage &M1 = LHS.Message;
const tooling::DiagnosticMessage &M2 = RHS.Message;
- return std::tie(M1.FilePath, M1.FileOffset, M1.Message) <
- std::tie(M2.FilePath, M2.FileOffset, M2.Message);
+ return
+ std::tie(M1.FilePath, M1.FileOffset, LHS.DiagnosticName, M1.Message) <
+ std::tie(M2.FilePath, M2.FileOffset, RHS.DiagnosticName, M2.Message);
}
};
struct EqualClangTidyError {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65065.213356.patch
Type: text/x-patch
Size: 1548 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190805/2e982f41/attachment.bin>
More information about the cfe-commits
mailing list