From 99b5a4648cd02e88f9d3df15589ab5938a618cdd Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Tue, 12 May 2015 10:20:32 +0000 Subject: clang-format: Fix */& detection for lambdas in macros. Before: #define MACRO() [](A * a) { return 1; } After: #define MACRO() [](A *a) { return 1; } llvm-svn: 237109 --- clang/lib/Format/TokenAnnotator.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'clang/lib/Format/TokenAnnotator.cpp') diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 58ce7aef743..6cf3f1d5230 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -125,16 +125,16 @@ private: Left->Previous->is(TT_BinaryOperator))) { // static_assert, if and while usually contain expressions. Contexts.back().IsExpression = true; - } else if (Line.InPPDirective && - (!Left->Previous || - !Left->Previous->isOneOf(tok::identifier, - TT_OverloadedOperator))) { - Contexts.back().IsExpression = true; } else if (Left->Previous && Left->Previous->is(tok::r_square) && Left->Previous->MatchingParen && Left->Previous->MatchingParen->is(TT_LambdaLSquare)) { // This is a parameter list of a lambda expression. Contexts.back().IsExpression = false; + } else if (Line.InPPDirective && + (!Left->Previous || + !Left->Previous->isOneOf(tok::identifier, + TT_OverloadedOperator))) { + Contexts.back().IsExpression = true; } else if (Contexts[Contexts.size() - 2].CaretFound) { // This is the parameter list of an ObjC block. Contexts.back().IsExpression = false; -- cgit v1.2.3