aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2025-01-04 16:24:41 -0800
committerGitHub <noreply@github.com>2025-01-04 16:24:41 -0800
commitc1ea05eaf0fbe4b539952689dbf9f0df716c72e7 (patch)
tree22e7763981a3230aa3f31857edaf7c88f9207c8d /clang/lib/Format/UnwrappedLineParser.cpp
parent44b83e81b5a48d543bf718907f00a21179ec03a4 (diff)
downloadllvm-c1ea05eaf0fbe4b539952689dbf9f0df716c72e7.zip
llvm-c1ea05eaf0fbe4b539952689dbf9f0df716c72e7.tar.gz
llvm-c1ea05eaf0fbe4b539952689dbf9f0df716c72e7.tar.bz2
[clang-format] Don't break short macro call followed by l_paren (#121626)
Fixes #105658.
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 46fd566..39aa37a 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2044,7 +2044,9 @@ void UnwrappedLineParser::parseStructuralElement(
? FormatTok->NewlinesBefore > 0
: CommentsBeforeNextToken.front()->NewlinesBefore > 0;
- if (FollowedByNewline && (Text.size() >= 5 || FunctionLike) &&
+ if (FollowedByNewline &&
+ (Text.size() >= 5 ||
+ (FunctionLike && FormatTok->isNot(tok::l_paren))) &&
tokenCanStartNewLine(*FormatTok) && Text == Text.upper()) {
if (PreviousToken->isNot(TT_UntouchableMacroFunc))
PreviousToken->setFinalizedType(TT_FunctionLikeOrFreestandingMacro);