summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-04-14 12:50:02 +0000
committerDaniel Jasper <djasper@google.com>2014-04-14 12:50:02 +0000
commit72ab43b28b09401d48dfbcf8c79cdc7ea6fb44b5 (patch)
tree9e530a2139ede1f22cd636cbf50bb31ddf76ae9d /clang/lib/Format
parent84aa310c82565b0f467250ec84917dc402608b0e (diff)
downloadbcm5719-llvm-72ab43b28b09401d48dfbcf8c79cdc7ea6fb44b5.tar.gz
bcm5719-llvm-72ab43b28b09401d48dfbcf8c79cdc7ea6fb44b5.zip
clang-format: Fix incorrect &&-detection in macros.
Before: #define A(a, b) (a &&b) After: #define A(a, b) (a && b) This fixes llvm.org/PR19343. llvm-svn: 206165
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index b81bf91c78b..410a84ecd2c 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -110,6 +110,9 @@ private:
Left->Previous->Type == TT_BinaryOperator)) {
// static_assert, if and while usually contain expressions.
Contexts.back().IsExpression = true;
+ } else if (Line.InPPDirective &&
+ (!Left->Previous || Left->Previous->isNot(tok::identifier))) {
+ Contexts.back().IsExpression = true;
} else if (Left->Previous && Left->Previous->is(tok::r_square) &&
Left->Previous->MatchingParen &&
Left->Previous->MatchingParen->Type == TT_LambdaLSquare) {
OpenPOWER on IntegriCloud