clang-format: Allow splitting "= default" and "= delete".
Otherwise, this can violate the column limit. llvm-svn: 235592
This commit is contained in:
parent
d0be0a9897
commit
caf84fe21e
|
@ -2063,7 +2063,8 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
|
|||
if (Left.isOneOf(TT_TemplateCloser, TT_UnaryOperator) ||
|
||||
Left.is(tok::kw_operator))
|
||||
return false;
|
||||
if (Left.is(tok::equal) && Line.Type == LT_VirtualFunctionDecl)
|
||||
if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) &&
|
||||
Line.Type == LT_VirtualFunctionDecl)
|
||||
return false;
|
||||
if (Left.is(tok::l_paren) && Left.is(TT_AttributeParen))
|
||||
return false;
|
||||
|
|
|
@ -2497,6 +2497,14 @@ TEST_F(FormatTest, FormatsSmallMacroDefinitionsInSingleLine) {
|
|||
TEST_F(FormatTest, DoesNotBreakPureVirtualFunctionDefinition) {
|
||||
verifyFormat("virtual void write(ELFWriter *writerrr,\n"
|
||||
" OwningPtr<FileOutputBuffer> &buffer) = 0;");
|
||||
|
||||
// Do break defaulted and deleted functions.
|
||||
verifyFormat("virtual void ~Deeeeeeeestructor() =\n"
|
||||
" default;",
|
||||
getLLVMStyleWithColumns(40));
|
||||
verifyFormat("virtual void ~Deeeeeeeestructor() =\n"
|
||||
" delete;",
|
||||
getLLVMStyleWithColumns(40));
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, BreaksStringLiteralsOnlyInDefine) {
|
||||
|
|
Loading…
Reference in New Issue