[clang] 2172eea - [clang-format][NFC] Take a constant conjunct out of a loop condition

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 18 17:37:50 PDT 2023


Author: Owen Pan
Date: 2023-10-18T17:37:41-07:00
New Revision: 2172eeaa52bec211b255e9cb4d8464a8908ff709

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

LOG: [clang-format][NFC] Take a constant conjunct out of a loop condition

Added: 
    

Modified: 
    clang/lib/Format/UnwrappedLineParser.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 708b70489a114e3..bdedfad3b78ba72 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1967,8 +1967,9 @@ void UnwrappedLineParser::parseStructuralElement(
         auto I = Line->Tokens.begin(), E = Line->Tokens.end();
         while (I != E && I->Tok->is(tok::comment))
           ++I;
-        while (I != E && Style.isVerilog() && I->Tok->is(tok::hash))
-          ++I;
+        if (Style.isVerilog())
+          while (I != E && I->Tok->is(tok::hash))
+            ++I;
         return I != E && (++I == E);
       };
       if (OneTokenSoFar()) {


        


More information about the cfe-commits mailing list