[clang-tools-extra] r281713 - [clang-tidy] Bugfix for readability-redundant-control-flow check
Kirill Bobyrev via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 16 03:12:09 PDT 2016
Author: omtcyfz
Date: Fri Sep 16 05:12:08 2016
New Revision: 281713
URL: http://llvm.org/viewvc/llvm-project?rev=281713&view=rev
Log:
[clang-tidy] Bugfix for readability-redundant-control-flow check
This check did not create FixItHints when the statement before the redundant
control flow was not followed by a semicolon.
Patch by Malcolm Parsons!
Reviewers: alexfh
Differential Revision: https://reviews.llvm.org/D24500
Modified:
clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp
Modified: clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp?rev=281713&r1=281712&r2=281713&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp Fri Sep 16 05:12:08 2016
@@ -83,7 +83,7 @@ void RedundantControlFlowCheck::issueDia
dyn_cast<Stmt>(*Previous)->getLocEnd(), tok::semi, SM,
Result.Context->getLangOpts(),
/*SkipTrailingWhitespaceAndNewLine=*/true);
- else
+ if (!Start.isValid())
Start = StmtRange.getBegin();
auto RemovedRange = CharSourceRange::getCharRange(
Start,
Modified: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp?rev=281713&r1=281712&r2=281713&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp Fri Sep 16 05:12:08 2016
@@ -179,6 +179,7 @@ void template_return(T check) {
// CHECK-FIXES: {{^}} if (check < T(0)) {{{$}}
// CHECK-FIXES-NEXT: {{^ return;$}}
// CHECK-FIXES-NEXT: {{^ *}$}}
+// CHECK-FIXES-NEXT: {{^ *}$}}
template <>
void template_return(int check) {
@@ -191,6 +192,7 @@ void template_return(int check) {
// CHECK-FIXES: {{^}} if (check < 0) {{{$}}
// CHECK-FIXES-NEXT: {{^ return;$}}
// CHECK-FIXES-NEXT: {{^ *}$}}
+// CHECK-FIXES-NEXT: {{^ *}$}}
template <typename T>
void template_loop(T end) {
More information about the cfe-commits
mailing list