Author: Björn Schäpers
Date: 2023-07-12T12:23:20+02:00
New Revision: ce7356f08194083c205b92e77d1a4cd515a2a5b8

URL: 
https://github.com/llvm/llvm-project/commit/ce7356f08194083c205b92e77d1a4cd515a2a5b8
DIFF: 
https://github.com/llvm/llvm-project/commit/ce7356f08194083c205b92e77d1a4cd515a2a5b8.diff

LOG: [clang-format] Don't eat two semicolons after namespace

Remove the double check, move the comment.

This changes behavior, but I think for the better. Despite the comment
my personal opinion would be to not even gracefully handle the one
semicolon, it shouldn't be there.

Differential Revision: https://reviews.llvm.org/D138373

Added: 
    

Modified: 
    clang/lib/Format/UnwrappedLineParser.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index 737ba52a1fb1b4..0ef2b1c3a46293 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2970,15 +2970,12 @@ void UnwrappedLineParser::parseNamespace() {
     if (ManageWhitesmithsBraces)
       ++Line->Level;
 
+    // Munch the semicolon after a namespace. This is more common than one 
would
+    // think. Putting the semicolon into its own line is very ugly.
     parseBlock(/*MustBeDeclaration=*/true, AddLevels, /*MunchSemi=*/true,
                /*KeepBraces=*/true, /*IfKind=*/nullptr,
                ManageWhitesmithsBraces);
 
-    // Munch the semicolon after a namespace. This is more common than one 
would
-    // think. Putting the semicolon into its own line is very ugly.
-    if (FormatTok->is(tok::semi))
-      nextToken();
-
     addUnwrappedLine(AddLevels > 0 ? LineLevel::Remove : LineLevel::Keep);
 
     if (ManageWhitesmithsBraces)


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to