[clang] 6e86789 - [clang-format][NFC] Use member directly

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


Author: Björn Schäpers
Date: 2021-12-04T21:29:31+01:00
New Revision: 6e8678903523019903222e4521a5e41af743cab0

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

LOG: [clang-format][NFC] Use member directly

Instead of passing it as argument to the member function.

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

Added: 
    

Modified: 
    clang/lib/Format/UnwrappedLineFormatter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 9753c24bfcdb..4c341aadbd01 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -62,7 +62,7 @@ class LevelIndentTracker {
       Indent = Line.Level * IndentWidth + AdditionalIndent;
     } else {
       IndentForLevel.resize(Line.Level + 1);
-      Indent = getIndent(IndentForLevel, Line.Level);
+      Indent = getIndent(Line.Level);
     }
     if (static_cast<int>(Indent) + Offset >= 0)
       Indent += Offset;
@@ -118,12 +118,12 @@ class LevelIndentTracker {
   /// \p IndentForLevel must contain the indent for the level \c l
   /// at \p IndentForLevel[l], or a value < 0 if the indent for
   /// that level is unknown.
-  unsigned getIndent(ArrayRef<int> IndentForLevel, unsigned Level) {
+  unsigned getIndent(unsigned Level) const {
     if (IndentForLevel[Level] != -1)
       return IndentForLevel[Level];
     if (Level == 0)
       return 0;
-    return getIndent(IndentForLevel, Level - 1) + Style.IndentWidth;
+    return getIndent(Level - 1) + Style.IndentWidth;
   }
 
   const FormatStyle &Style;


        


More information about the cfe-commits mailing list