summaryrefslogtreecommitdiff
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.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index a161ee87e6b5..5b3a450e31f2 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2923,9 +2923,15 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
}
bool TokenAnnotator::spaceRequiredBeforeParens(const FormatToken &Right) const {
- return Style.SpaceBeforeParens == FormatStyle::SBPO_Always ||
- (Style.SpaceBeforeParensOptions.BeforeNonEmptyParentheses &&
- Right.ParameterCount > 0);
+ if (Style.SpaceBeforeParens == FormatStyle::SBPO_Always)
+ return true;
+ if (Right.is(TT_OverloadedOperatorLParen) &&
+ Style.SpaceBeforeParensOptions.AfterOverloadedOperator)
+ return true;
+ if (Style.SpaceBeforeParensOptions.BeforeNonEmptyParentheses &&
+ Right.ParameterCount > 0)
+ return true;
+ return false;
}
bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,