aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 25fcceb87864..d0c4273cfc7e 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2488,6 +2488,8 @@ private:
(Tok.Next->Next->is(tok::numeric_constant) || Line.InPPDirective)) {
return false;
}
+ if (Line.InPPDirective && Tok.Next->is(tok::minus))
+ return false;
// Search for unexpected tokens.
for (FormatToken *Prev = Tok.Previous; Prev != Tok.MatchingParen;
Prev = Prev->Previous) {
@@ -4272,14 +4274,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
Left.isOneOf(tok::kw_new, tok::kw_delete) &&
Right.isNot(TT_OverloadedOperatorLParen) &&
!(Line.MightBeFunctionDecl && Left.is(TT_FunctionDeclarationName))) {
- if (Style.SpaceBeforeParensOptions.AfterPlacementOperator ==
- FormatStyle::SpaceBeforeParensCustom::APO_Always ||
- (Style.SpaceBeforeParensOptions.AfterPlacementOperator ==
- FormatStyle::SpaceBeforeParensCustom::APO_Leave &&
- Right.hasWhitespaceBefore())) {
- return true;
- }
- return false;
+ return Style.SpaceBeforeParensOptions.AfterPlacementOperator;
}
if (Line.Type == LT_ObjCDecl)
return true;