clang-format: Improve boolean expression formatting in macros.
Before:
#define IF(a, b, c) if (a&&(b == c))
After:
#define IF(a, b, c) if (a && (b == c))
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188256 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 4feddfd..94acbd3 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -93,7 +93,8 @@
}
}
- if (Left->Previous && Left->Previous->is(tok::kw_static_assert))
+ if (Left->Previous && Left->Previous->isOneOf(tok::kw_static_assert,
+ tok::kw_if, tok::kw_while))
Contexts.back().IsExpression = true;
if (StartsObjCMethodExpr) {