[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

llvm-svn: 281713
This commit is contained in:
Kirill Bobyrev 2016-09-16 10:12:08 +00:00
parent f9b141d16d
commit d7f2a35cac
2 changed files with 3 additions and 1 deletions

View File

@ -83,7 +83,7 @@ void RedundantControlFlowCheck::issueDiagnostic(
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,

View File

@ -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) {