[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else...
authorPaul Hoad <mydeveloperday@gmail.com>
Wed, 13 Mar 2019 08:07:46 +0000 (08:07 +0000)
committerPaul Hoad <mydeveloperday@gmail.com>
Wed, 13 Mar 2019 08:07:46 +0000 (08:07 +0000)
commit6d294f28e9a24ca941f88bce7c8ed98d5931a3fc
treea363e53eba8806c486f841b347577c0679edc5f5
parent4a725996e5f6688b3177021fb47f0b0570985ce1
[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present

Summary:
Addressing: PR25010 - https://bugs.llvm.org/show_bug.cgi?id=25010

Code like:

```
    if(true) var++;
    else  {
        var--;
    }
```

is reformatted to be

```
  if (true)
    var++;
  else {
    var--;
  }
```

Even when `AllowShortIfStatementsOnASingleLine` is true

The following revision comes from a +1'd suggestion in the PR to support AllowShortIfElseStatementsOnASingleLine

This suppresses the clause prevents the merging of the if when there is a compound else

Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, reuk
Reviewed By: reuk
Subscribers: reuk, Higuoxing, jdoerfert, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D59087

llvm-svn: 356029
clang-tools-extra/docs/clang-tidy/checks/readability-identifier-naming.rst
clang-tools-extra/docs/conf.py
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/UnwrappedLineFormatter.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/FormatTestSelective.cpp
llvm/utils/release/build_llvm_package.bat