[clang-tools-extra] r356029 - [clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present

Paul Hoad via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 01:07:46 PDT 2019


Author: paulhoad
Date: Wed Mar 13 01:07:46 2019
New Revision: 356029

URL: http://llvm.org/viewvc/llvm-project?rev=356029&view=rev
Log:
[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

Modified:
    clang-tools-extra/trunk/docs/clang-tidy/checks/readability-identifier-naming.rst
    clang-tools-extra/trunk/docs/conf.py

Modified: clang-tools-extra/trunk/docs/clang-tidy/checks/readability-identifier-naming.rst
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/readability-identifier-naming.rst?rev=356029&r1=356028&r2=356029&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/clang-tidy/checks/readability-identifier-naming.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/readability-identifier-naming.rst Wed Mar 13 01:07:46 2019
@@ -9,7 +9,7 @@ This check will try to enforce coding gu
 supports one of the following casing types and tries to convert from one to
 another if a mismatch is detected
 
-Casing types inclde:
+Casing types include:
 
  - ``lower_case``,
  - ``UPPER_CASE``,

Modified: clang-tools-extra/trunk/docs/conf.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/conf.py?rev=356029&r1=356028&r2=356029&view=diff
==============================================================================
--- clang-tools-extra/trunk/docs/conf.py (original)
+++ clang-tools-extra/trunk/docs/conf.py Wed Mar 13 01:07:46 2019
@@ -26,7 +26,7 @@ from datetime import date
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.todo', 'sphinx.ext.mathjax']
+extensions = ['sphinx.ext.todo', 'sphinx.ext.mathjax', 'sphinxcontrib.spelling' ]
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']




More information about the cfe-commits mailing list