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

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 3 12:03:37 PST 2021

HazardyKnusperkeks created this revision.
HazardyKnusperkeks added reviewers: MyDeveloperDay, owenpan, curdeius.
HazardyKnusperkeks added a project: clang-format.
HazardyKnusperkeks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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

  rG LLVM Github Monorepo



Index: clang/lib/Format/ContinuationIndenter.cpp
--- clang/lib/Format/ContinuationIndenter.cpp
+++ clang/lib/Format/ContinuationIndenter.cpp
@@ -1337,6 +1337,9 @@
 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115070.391704.patch
Type: text/x-patch
Size: 611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211203/2f3ad88b/attachment.bin>

More information about the cfe-commits mailing list