clang-format: Improve binary operator detection in macros.
Before:
#define M(NAME) assert(!Context.Verifying &&#NAME);
After:
#define M(NAME) assert(!Context.Verifying && #NAME);
This fixes llvm.org/PR16156.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194216 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 69e5585..5c70c8f 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -620,7 +620,7 @@
Contexts.back().InCtorInitializer = true;
} else if (Current.is(tok::kw_new)) {
Contexts.back().CanBeExpression = false;
- } else if (Current.is(tok::semi)) {
+ } else if (Current.is(tok::semi) || Current.is(tok::exclaim)) {
// This should be the condition or increment in a for-loop.
Contexts.back().IsExpression = true;
}