aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-05-03 14:41:24 +0000
committerDaniel Jasper <djasper@google.com>2013-05-03 14:41:24 +0000
commit16a69ef481f4580c571b6c693a5d3dd64ea56b53 (patch)
treee0b579adc0d8c4d3c41f8efad3233d8f9687e2ec /lib
parent8eead16398c003dc2a8be22f44e8c2d92af80479 (diff)
Fix expression recognition in for-loops.
Before: for (; a&& b;) {} After: for (; a && b;) {} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181017 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Format/TokenAnnotator.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 3e67182f87..6fa79813fa 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -596,6 +596,9 @@ private:
Contexts.back().IsExpression = true;
} else if (Current.is(tok::kw_new)) {
Contexts.back().CanBeExpression = false;
+ } else if (Current.is(tok::semi)) {
+ // This should be the condition or increment in a for-loop.
+ Contexts.back().IsExpression = true;
}
if (Current.Type == TT_Unknown) {