[PATCH] D24500: [clang-tidy] Bugfix for readability-redundant-control-flow check

Kirill Bobyrev via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 16 03:20:44 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL281713: [clang-tidy] Bugfix for readability-redundant-control-flow check (authored by omtcyfz).

Changed prior to commit:
  https://reviews.llvm.org/D24500?vs=71140&id=71608#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24500

Files:
  clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp

Index: clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/RedundantControlFlowCheck.cpp
@@ -83,7 +83,7 @@
         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,
Index: clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/readability-redundant-control-flow.cpp
@@ -179,6 +179,7 @@
 // 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 @@
 // CHECK-FIXES: {{^}}  if (check < 0) {{{$}}
 // CHECK-FIXES-NEXT: {{^    return;$}}
 // CHECK-FIXES-NEXT: {{^ *}$}}
+// CHECK-FIXES-NEXT: {{^ *}$}}
 
 template <typename T>
 void template_loop(T end) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24500.71608.patch
Type: text/x-patch
Size: 1392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160916/8f81ee1d/attachment.bin>


More information about the cfe-commits mailing list