llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-format Author: Tshaka Lekholoane (tshakalekholoane) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/223355.diff 1 Files Affected: - (modified) clang/lib/Format/TokenAnnotator.cpp (+11) ``````````diff diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 32ae8990f52c5..996705f1bdc6f 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -5044,6 +5044,17 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, return true; // Space before parentheses common for all languages if (Right.is(tok::l_paren)) { + // Space between the return type and the parameter list of an + // Objective-C/Blocks block literal that has an explicit return + // type, e.g. ^bool (int x) { ... }. Note that a block literal with + // no explicit return type, e.g. ^(int x) { ... }, is deliberately + // left alone: Left is the caret itself in that case, not an + // identifier. + if (BeforeLeft && BeforeLeft->is(tok::caret) && + BeforeLeft->is(TT_UnaryOperator) && + (Left.is(tok::identifier) || Left.isTypeName(LangOpts))) { + return true; + } // Function declaration or definition if (Line.MightBeFunctionDecl && Right.is(TT_FunctionDeclarationLParen)) { if (spaceRequiredBeforeParens(Right)) `````````` </details> https://github.com/llvm/llvm-project/pull/223355 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
