Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/Format/UnwrappedLineParser.cpp
Show First 20 Lines • Show All 2,980 Lines • ▼ Show 20 Lines | bool ManageWhitesmithsBraces = | ||||
AddLevels == 0u && | AddLevels == 0u && | ||||
Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths; | Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths; | ||||
// If we're in Whitesmiths mode, indent the brace if we're not indenting | // If we're in Whitesmiths mode, indent the brace if we're not indenting | ||||
// the whole block. | // the whole block. | ||||
if (ManageWhitesmithsBraces) | if (ManageWhitesmithsBraces) | ||||
++Line->Level; | ++Line->Level; | ||||
FormatToken *LBrace = FormatTok; | |||||
LBrace->setFinalizedType(TT_NamespaceLBrace); | |||||
parseBlock(/*MustBeDeclaration=*/true, AddLevels, /*MunchSemi=*/true, | parseBlock(/*MustBeDeclaration=*/true, AddLevels, /*MunchSemi=*/true, | ||||
/*KeepBraces=*/nullptr, /*IfKind=*/nullptr, | /*KeepBraces=*/nullptr, /*IfKind=*/nullptr, | ||||
ManageWhitesmithsBraces); | ManageWhitesmithsBraces); | ||||
if (LBrace->MatchingParen) | |||||
LBrace->MatchingParen->setFinalizedType(TT_NamespaceRBrace); | |||||
// Munch the semicolon after a namespace. This is more common than one would | // Munch the semicolon after a namespace. This is more common than one would | ||||
// think. Putting the semicolon into its own line is very ugly. | // think. Putting the semicolon into its own line is very ugly. | ||||
if (FormatTok->is(tok::semi)) | if (FormatTok->is(tok::semi)) | ||||
nextToken(); | nextToken(); | ||||
addUnwrappedLine(AddLevels > 0 ? LineLevel::Remove : LineLevel::Keep); | addUnwrappedLine(AddLevels > 0 ? LineLevel::Remove : LineLevel::Keep); | ||||
if (ManageWhitesmithsBraces) | if (ManageWhitesmithsBraces) | ||||
▲ Show 20 Lines • Show All 1,674 Lines • Show Last 20 Lines |