diff options
| author | Daniel Jasper <djasper@google.com> | 2013-10-18 17:20:57 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-10-18 17:20:57 +0000 |
| commit | fbc057ea73cf5c7b6ff77bf040c698a6021e23f9 (patch) | |
| tree | 3a5a59c77ad2f4615c1a3582792aeb18129c77d3 /clang/lib/Format | |
| parent | b1499243f355a12d735ea6f512dbc31c4fa733f2 (diff) | |
| download | bcm5719-llvm-fbc057ea73cf5c7b6ff77bf040c698a6021e23f9.tar.gz bcm5719-llvm-fbc057ea73cf5c7b6ff77bf040c698a6021e23f9.zip | |
clang-format: Be more aggressive on incorrect code.
Before, clang-format would not adjust leading indents if it found a
structural error (e.g. unmatched {}). It seems, however, that
clang-format has gotten good enough at parsing the code structure that
this hurts in almost all cases. Commonly, while writing code, it is
very useful to be able to correclty indent incomplete if statements or
for loops.
In case this leads to errors that we don't anticipate, we need to find
out and fix those.
This fixed llvm.org/PR17594.
llvm-svn: 192988
Diffstat (limited to 'clang/lib/Format')
| -rw-r--r-- | clang/lib/Format/Format.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 3496712e3cf..90c3e9e96d5 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -915,10 +915,7 @@ public: } else if (TheLine.Type != LT_Invalid && (WasMoved || FormatPPDirective || touchesLine(TheLine))) { unsigned LevelIndent = getIndent(IndentForLevel, TheLine.Level); - if (FirstTok->WhitespaceRange.isValid() && - // Insert a break even if there is a structural error in case where - // we break apart a line consisting of multiple unwrapped lines. - (FirstTok->NewlinesBefore == 0 || !StructuralError)) { + if (FirstTok->WhitespaceRange.isValid()) { formatFirstToken(*TheLine.First, PreviousLine, TheLine.Level, Indent, TheLine.InPPDirective); } else { |

