Author: Marek Kurdej
Date: 2022-03-14T11:59:52+01:00
New Revision: 2507e0a257991fd46bd847c8fa0964bc70891add

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

LOG: [clang-format] Clean up UnwrappedLineParser::parseRecord. NFC.

Added: 
    

Modified: 
    clang/lib/Format/UnwrappedLineParser.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index 47e794c7b1ca6..b03296c7e02d9 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -3511,7 +3511,7 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
   // (this would still leave us with an ambiguity between template function
   // and class declarations).
   if (FormatTok->isOneOf(tok::colon, tok::less)) {
-    while (!eof()) {
+    do {
       if (FormatTok->is(tok::l_brace)) {
         calculateBraceTypes(/*ExpectClassBody=*/true);
         if (!tryToParseBracedList())
@@ -3525,6 +3525,9 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
           // it was probably a pointer to an array: int (*)[].
           if (!tryToParseLambda())
             break;
+        } else {
+          parseSquare();
+          continue;
         }
       }
       if (FormatTok->is(tok::semi))
@@ -3536,7 +3539,7 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
         break;
       }
       nextToken();
-    }
+    } while (!eof());
   }
 
   auto GetBraceType = [](const FormatToken &RecordTok) {


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

Reply via email to