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) {
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) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits