diff options
author | Daniel Jasper <djasper@google.com> | 2014-04-14 12:50:02 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-04-14 12:50:02 +0000 |
commit | 72ab43b28b09401d48dfbcf8c79cdc7ea6fb44b5 (patch) | |
tree | 9e530a2139ede1f22cd636cbf50bb31ddf76ae9d /clang/lib/Format | |
parent | 84aa310c82565b0f467250ec84917dc402608b0e (diff) | |
download | bcm5719-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.cpp | 3 |
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) { |