owenca wrote:
Actually, I would do the following NFC instead:
```diff
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1714,7 +1714,7 @@ void UnwrappedLineParser::parseStructuralElement(
if (!Line->InMacroBody || CurrentLines->size() > 1)
Line->Tokens.begin()->Tok->MustBreakBefore = true;
FormatTok->setFinalizedType(TT_GotoLabelColon);
- parseLabel(Style.IndentGotoLabels);
+ parseLabel(/*IsGotoLabel=*/true);
if (HasLabel)
*HasLabel = true;
return;
@@ -3372,13 +3372,11 @@ void UnwrappedLineParser::parseDoWhile() {
parseStructuralElement();
}
-void UnwrappedLineParser::parseLabel(
- FormatStyle::IndentGotoLabelStyle IndentGotoLabels) {
- const bool IsGotoLabel = FormatTok->is(TT_GotoLabelColon);
+void UnwrappedLineParser::parseLabel(bool IsGotoLabel) {
nextToken();
unsigned OldLineLevel = Line->Level;
- switch (IndentGotoLabels) {
+ switch (Style.IndentGotoLabels) {
case FormatStyle::IGLS_NoIndent:
Line->Level = 0;
break;
diff --git a/clang/lib/Format/UnwrappedLineParser.h
b/clang/lib/Format/UnwrappedLineParser.h
index 8181eec1495f..5553490f52f8 100644
--- a/clang/lib/Format/UnwrappedLineParser.h
+++ b/clang/lib/Format/UnwrappedLineParser.h
@@ -159,8 +159,7 @@ private:
void parseLoopBody(bool KeepBraces, bool WrapRightBrace);
void parseForOrWhileLoop(bool HasParens = true);
void parseDoWhile();
- void parseLabel(FormatStyle::IndentGotoLabelStyle IndentGotoLabels =
- FormatStyle::IGLS_OuterIndent);
+ void parseLabel(bool IsGotoLabel = false);
void parseCaseLabel();
void parseSwitch(bool IsExpr);
void parseNamespace();
```
You can also clean up the function if you want (in this patch or a follow-up
one).
https://github.com/llvm/llvm-project/pull/196815
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits