[clang] d2af1ea - [clang-format][NFC] Minor improvement to parseLabel()
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Thu May 2 19:48:47 PDT 2024
Author: Owen Pan
Date: 2024-05-02T19:42:01-07:00
New Revision: d2af1ea81dd0170133c53ebd67c9a9be125dfd31
URL: https://github.com/llvm/llvm-project/commit/d2af1ea81dd0170133c53ebd67c9a9be125dfd31
DIFF: https://github.com/llvm/llvm-project/commit/d2af1ea81dd0170133c53ebd67c9a9be125dfd31.diff
LOG: [clang-format][NFC] Minor improvement to parseLabel()
Added:
Modified:
clang/lib/Format/UnwrappedLineParser.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 854428389740d8..e8a8dd58d07eea 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -3201,10 +3201,11 @@ void UnwrappedLineParser::parseDoWhile() {
void UnwrappedLineParser::parseLabel(bool LeftAlignLabel) {
nextToken();
unsigned OldLineLevel = Line->Level;
- if (Line->Level > 1 || (!Line->InPPDirective && Line->Level > 0))
- --Line->Level;
+
if (LeftAlignLabel)
Line->Level = 0;
+ else if (Line->Level > 1 || (!Line->InPPDirective && Line->Level > 0))
+ --Line->Level;
if (!Style.IndentCaseBlocks && CommentsBeforeNextToken.empty() &&
FormatTok->is(tok::l_brace)) {
More information about the cfe-commits
mailing list