This revision was automatically updated to reflect the committed changes. Closed by commit rG2b51c8cd2ac6: [clang-tidy] Clarify bugprone-branch-clone diagnostic message (authored by donat.nagy, committed by Donát Nagy <m1nag...@protonmail.com>).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D143917/new/ https://reviews.llvm.org/D143917 Files: clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-if-constexpr-template.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-macro-crash.c clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone.cpp
Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone.cpp +++ clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone.cpp @@ -388,7 +388,7 @@ void test_chain1(int in, int &out) { if (in > 77) -// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: repeated branch in conditional chain [bugprone-branch-clone] +// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: repeated branch body in conditional chain [bugprone-branch-clone] out++; // CHECK-MESSAGES: :[[@LINE-1]]:10: note: end of the original else if (in > 55) @@ -400,7 +400,7 @@ void test_chain2(int in, int &out) { if (in > 77) -// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: repeated branch in conditional chain [bugprone-branch-clone] +// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: repeated branch body in conditional chain [bugprone-branch-clone] out++; // CHECK-MESSAGES: :[[@LINE-1]]:10: note: end of the original else if (in > 55) @@ -422,7 +422,7 @@ void test_chain3(int in, int &out) { if (in > 77) { -// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: repeated branch in conditional chain [bugprone-branch-clone] +// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: repeated branch body in conditional chain [bugprone-branch-clone] out++; out++; // CHECK-MESSAGES: :[[@LINE+1]]:4: note: end of the original @@ -452,7 +452,7 @@ // describes all branches of the first one before mentioning the second one. void test_chain4(int in, int &out) { if (in > 77) { -// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: repeated branch in conditional chain [bugprone-branch-clone] +// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: repeated branch body in conditional chain [bugprone-branch-clone] out++; out++; // CHECK-MESSAGES: :[[@LINE+1]]:4: note: end of the original @@ -463,7 +463,7 @@ out++; out++; } else if (in > 42) -// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: repeated branch in conditional chain [bugprone-branch-clone] +// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: repeated branch body in conditional chain [bugprone-branch-clone] out--; // CHECK-MESSAGES: :[[@LINE-1]]:10: note: end of the original else if (in > 28) { @@ -485,7 +485,7 @@ void test_chain5(int in, int &out) { if (in > 77) -// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: repeated branch in conditional chain [bugprone-branch-clone] +// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: repeated branch body in conditional chain [bugprone-branch-clone] out++; // CHECK-MESSAGES: :[[@LINE-1]]:10: note: end of the original else if (in > 55) @@ -507,7 +507,7 @@ void test_chain6(int in, int &out) { if (in > 77) { -// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: repeated branch in conditional chain [bugprone-branch-clone] +// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: repeated branch body in conditional chain [bugprone-branch-clone] out++; out++; // CHECK-MESSAGES: :[[@LINE+1]]:4: note: end of the original @@ -538,7 +538,7 @@ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: if with identical then and else branches [bugprone-branch-clone] // CHECK-MESSAGES: :[[@LINE+27]]:5: note: else branch starts here if (b > 5) { -// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: repeated branch in conditional chain [bugprone-branch-clone] +// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: repeated branch body in conditional chain [bugprone-branch-clone] // CHECK-MESSAGES: :[[@LINE+9]]:6: note: end of the original // CHECK-MESSAGES: :[[@LINE+8]]:24: note: clone 1 starts here // CHECK-MESSAGES: :[[@LINE+14]]:12: note: clone 2 starts here @@ -565,7 +565,7 @@ } } else { if (b > 5) { -// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: repeated branch in conditional chain [bugprone-branch-clone] +// CHECK-MESSAGES: :[[@LINE-1]]:16: warning: repeated branch body in conditional chain [bugprone-branch-clone] // CHECK-MESSAGES: :[[@LINE+9]]:6: note: end of the original // CHECK-MESSAGES: :[[@LINE+8]]:24: note: clone 1 starts here // CHECK-MESSAGES: :[[@LINE+14]]:12: note: clone 2 starts here @@ -948,7 +948,7 @@ return 'A'; if (in > 77) -// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: repeated branch in conditional chain [bugprone-branch-clone] +// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: repeated branch body in conditional chain [bugprone-branch-clone] out++; // CHECK-MESSAGES: :[[@LINE-1]]:10: note: end of the original else if (in > 55) Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-macro-crash.c =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-macro-crash.c +++ clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-macro-crash.c @@ -9,6 +9,6 @@ d = b; void f(void) { - // CHECK-MESSAGES: warning: repeated branch in conditional chain [bugprone-branch-clone] + // CHECK-MESSAGES: warning: repeated branch body in conditional chain [bugprone-branch-clone] a(x, y) } Index: clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-if-constexpr-template.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-if-constexpr-template.cpp +++ clang-tools-extra/test/clang-tidy/checkers/bugprone/branch-clone-if-constexpr-template.cpp @@ -5,7 +5,7 @@ template <unsigned Index> void shouldFail() { if constexpr (Index == 0) { - // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: repeated branch in conditional chain [bugprone-branch-clone] + // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: repeated branch body in conditional chain [bugprone-branch-clone] handle(0); } else if constexpr (Index == 1) { handle(1); @@ -28,7 +28,7 @@ void shouldFailNonTemplate() { constexpr unsigned Index = 1; if constexpr (Index == 0) { - // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: repeated branch in conditional chain [bugprone-branch-clone] + // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: repeated branch body in conditional chain [bugprone-branch-clone] handle(0); } else if constexpr (Index == 1) { handle(1); Index: clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp +++ clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp @@ -141,7 +141,7 @@ if (NumCopies == 2) { // We report the first occurrence only when we find the second one. diag(Branches[I]->getBeginLoc(), - "repeated branch in conditional chain"); + "repeated branch body in conditional chain"); SourceLocation End = Lexer::getLocForEndOfToken(Branches[I]->getEndLoc(), 0, *Result.SourceManager, getLangOpts());
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits