[llvm-bugs] [Bug 48659] New: clang-format splits function pointer in half

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 4 16:32:15 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=48659

            Bug ID: 48659
           Summary: clang-format splits function pointer in half
           Product: clang
           Version: 11.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: barry.revzin at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Here is a complete header:

template <typename R, typename... Args>
struct C { 
    R (*invoker)(void*, Args&&...);
};

which formats as:

$ clang-format wat.h 
template <typename R, typename... Args>
struct C {
    R (*invoker)
    (void*, Args&&...);
};

That should definitely stay on one line. 

My current .clang-format is:

AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignOperands: false
AllowAllParametersOfDeclarationOnNextLine: false
AlwaysBreakBeforeMultilineStrings: false
BasedOnStyle: Google
BinPackParameters: false
BreakBeforeBinaryOperators: None
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 0
ConstructorInitializerAllOnOneLineOrOnePerLine: false
IncludeCategories:
- Priority: 2
  Regex: ^"(llvm|llvm-c|clang|clang-c)/
- Priority: 3
  Regex: ^(<|"(gtest|isl|json)/)
- Priority: 1
  Regex: .*
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
PenaltyReturnTypeOnItsOwnLine: 60
ReflowComments: false
SortIncludes: false
SpacesBeforeTrailingComments: 1
TabWidth: 8
UseTab: Never
## Other available options and their default values:
# AlignConsecutiveAssignments: false
# AlignConsecutiveBitFields: false
# AlignConsecutiveDeclarations: false
# AlignConsecutiveMacros: false
# AlignEscapedNewlines: Right
# AlignTrailingComments: false
# AllowAllArgumentsOnNextLine: true
# AllowAllConstructorInitializersOnNextLine: true
# AllowShortBlocksOnASingleLine: Empty
# AllowShortCaseLabelsOnASingleLine: false
# AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
# AllowShortIfStatementsOnASingleLine: Never
# AllowShortLambdasOnASingleLine: All
# AllowShortLoopsOnASingleLine: false
# AlwaysBreakAfterDefinitionReturnType: None
# AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
# BinPackArguments: true
BraceWrapping:
#   AfterCaseLabel: false
   AfterClass: false
#   AfterControlStatement: Never
#   AfterEnum: false
#   AfterExternBlock: false
   AfterFunction: true
#   AfterNamespace: false
#   AfterObjCDeclaration: false
   AfterStruct: false
#   AfterUnion: false
#   BeforeCatch: false
#   BeforeElse: false
#   BeforeLambdaBody: false
#   BeforeWhile: false
#   IndentBraces: false
   SplitEmptyFunction: false
#   SplitEmptyNamespace: true
   SplitEmptyRecord: false
# BreakAfterJavaFieldAnnotations: false
BreakBeforeBraces: Custom
# BreakBeforeInheritanceComma: false
# BreakBeforeTernaryOperators: true
# BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
# BreakStringLiterals: true
# CommentPragmas: '^ IWYU pragma:'
# CompactNamespaces: false
# ConstructorInitializerIndentWidth: 4
# ContinuationIndentWidth: 4
# Cpp11BracedListStyle: false
# DeriveLineEnding: true
# DerivePointerAlignment: false
# DisableFormat: false
# ExperimentalAutoDetectBinPacking: false
# FixNamespaceComments: false
# ForEachMacros:
# - foreach
# - Q_FOREACH
# - BOOST_FOREACH
# IncludeBlocks: Preserve
# IncludeIsMainRegex: (Test)?$
# IncludeIsMainSourceRegex: ''
# IndentCaseBlocks: false
# IndentCaseLabels: false
# IndentExternBlock: AfterExternBlock
# IndentGotoLabels: true
IndentPPDirectives: AfterHash
# IndentWrappedFunctionNames: false
# InsertTrailingCommas: None
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
# Language: Cpp
# MacroBlockBegin: ''
# MacroBlockEnd: ''
# NamespaceIndentation: Inner
# ObjCBinPackProtocolList: Auto
# ObjCBlockIndentWidth: 4
# ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceAfterProperty: true
# ObjCSpaceBeforeProtocolList: true
# PenaltyBreakAssignment: 2
# PenaltyBreakBeforeFirstCallParameter: 19
# PenaltyBreakComment: 300
# PenaltyBreakFirstLessLess: 120
# PenaltyBreakString: 1000
# PenaltyBreakTemplateDeclaration: 10
# PenaltyExcessCharacter: 1000000
# PointerAlignment: Left
# SortUsingDeclarations: true
# SpaceAfterCStyleCast: false
# SpaceAfterLogicalNot: false
# SpaceAfterTemplateKeyword: true
# SpaceBeforeAssignmentOperators: true
# SpaceBeforeCpp11BracedList: true
# SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
# SpaceBeforeSquareBrackets: false
# SpaceInEmptyBlock: true
# SpaceInEmptyParentheses: false
# SpacesInAngles: false
# SpacesInCStyleCastParentheses: false
# SpacesInConditionalStatement: false
# SpacesInContainerLiterals: true
# SpacesInParentheses: false
# SpacesInSquareBrackets: false
# Standard: Latest
StatementMacros: [JMP_INVOKE_RET]
# - Q_UNUSED
# - QT_REQUIRE_VERSION
# UseCRLF: false
# WhitespaceSensitiveMacros:
# - STRINGIZE
# - PP_STRINGIZE
# - BOOST_PP_STRINGIZE

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210105/bf780ac4/attachment-0001.html>


More information about the llvm-bugs mailing list