summaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-10-18 17:20:57 +0000
committerDaniel Jasper <djasper@google.com>2013-10-18 17:20:57 +0000
commit0baf33b73e2bd6657ee202e2016daf010b8b58b9 (patch)
treed32a6ecc99e6a537c40a2da69001527edd6840fa /lib/Format/Format.cpp
parent49c77b2e702b02a0fbac7b817ccb73e7c128f9d9 (diff)
downloadclang-0baf33b73e2bd6657ee202e2016daf010b8b58b9.tar.gz
clang-0baf33b73e2bd6657ee202e2016daf010b8b58b9.tar.bz2
clang-0baf33b73e2bd6657ee202e2016daf010b8b58b9.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192988 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 3496712e3c..90c3e9e96d 100644
--- a/lib/Format/Format.cpp
+++ b/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 {