[clang] 4041f16 - [clang-format][NFC] Early return when nothing to do

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 4 12:30:19 PST 2021


Author: Björn Schäpers
Date: 2021-12-04T21:29:30+01:00
New Revision: 4041f16bb489d6cbdebfed33a2c5cc586cb3839b

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

LOG: [clang-format][NFC] Early return when nothing to do

Do not compute SkipFirstExtraIndent just to see that there are no fake l
parens.

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

Added: 
    

Modified: 
    clang/lib/Format/ContinuationIndenter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index cbb8d5093ca0..04d05e16c1a0 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -1337,6 +1337,9 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State,
 void ContinuationIndenter::moveStatePastFakeLParens(LineState &State,
                                                     bool Newline) {
   const FormatToken &Current = *State.NextToken;
+  if (Current.FakeLParens.empty())
+    return;
+
   const FormatToken *Previous = Current.getPreviousNonComment();
 
   // Don't add extra indentation for the first fake parenthesis after


        


More information about the cfe-commits mailing list