[cfe-dev] clang-format: ShortFunctionsOnASingleLine

Florian Lindner via cfe-dev cfe-dev at lists.llvm.org
Thu Oct 15 07:07:55 PDT 2015


Ok, complete config is:

---
Language:        Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: false
AlignEscapedNewlinesLeft: true
AlignOperands:   true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Linux
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit:     0
CommentPragmas:  '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat:   false
ExperimentalAutoDetectBinPacking: false
ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
IndentCaseLabels: false
IndentWidth:     2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd:   ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles:  false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard:        Cpp11
TabWidth:        8
UseTab:          Never
...


I will file a bug.

Best,
Florian

Am Donnerstag, 15. Oktober 2015, 06:30:21 schrieb Daniel Jasper:
> Seems like that option doesn't properly work together with the brace style
> you have selected. Feel free to file a bug.
> 
> On Thu, Oct 15, 2015 at 6:14 AM, Florian Lindner via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
> 
> > Hello,
> >
> > I have this piece of code:
> >
> > class C
> > {
> >   C() {}
> > };
> >
> > void f() {}
> >
> > AllowShortFunctionsOnASingleLine is set to empty, so I expect these
> > function to be left as is.
> >
> > florian at asaru ~/scratch (git)-[master] % clang-format -style=file
> > -dump-config | grep ShortFunction
> > AllowShortFunctionsOnASingleLine: Empty
> >
> > However:
> >
> > florian at asaru ~/scratch (git)-[master] % clang-format -style=file
> > clangformat.cpp
> > class C
> > {
> >   C()
> >   {
> >   }
> > };
> >
> > void f()
> > {
> > }
> >
> >
> > Is there something I misunderstand about this option?
> >
> > Thanks,
> > Florian
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> >



More information about the cfe-dev mailing list