[clang] 543c929 - [clang][Diagnostics][NFC] Remove unused Indentation parameter

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Wed May 31 01:17:35 PDT 2023


Author: Timm Bäder
Date: 2023-05-31T10:17:03+02:00
New Revision: 543c92969ba867434af6688808998b82496e9dc1

URL: https://github.com/llvm/llvm-project/commit/543c92969ba867434af6688808998b82496e9dc1
DIFF: https://github.com/llvm/llvm-project/commit/543c92969ba867434af6688808998b82496e9dc1.diff

LOG: [clang][Diagnostics][NFC] Remove unused Indentation parameter

printWordWrapped() is only called in one place, which passes all
parameters except `Indentation`. So, remove that parameter and use its
default value instead. Also remove the other default parameter values,
since those are unneeded.

Added: 
    

Modified: 
    clang/lib/Frontend/TextDiagnostic.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp
index 7a2d78b504f8..74c555e30689 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -590,15 +590,10 @@ static unsigned findEndOfWord(unsigned Start, StringRef Str,
 /// Str will be printed. This will be non-zero when part of the first
 /// line has already been printed.
 /// \param Bold if the current text should be bold
-/// \param Indentation the number of spaces to indent any lines beyond
-/// the first line.
 /// \returns true if word-wrapping was required, or false if the
 /// string fit on the first line.
-static bool printWordWrapped(raw_ostream &OS, StringRef Str,
-                             unsigned Columns,
-                             unsigned Column = 0,
-                             bool Bold = false,
-                             unsigned Indentation = WordWrapIndentation) {
+static bool printWordWrapped(raw_ostream &OS, StringRef Str, unsigned Columns,
+                             unsigned Column, bool Bold) {
   const unsigned Length = std::min(Str.find('\n'), Str.size());
   bool TextNormal = true;
 
@@ -630,10 +625,10 @@ static bool printWordWrapped(raw_ostream &OS, StringRef Str,
     // This word does not fit on the current line, so wrap to the next
     // line.
     OS << '\n';
-    OS.indent(Indentation);
+    OS.indent(WordWrapIndentation);
     applyTemplateHighlighting(OS, Str.substr(WordStart, WordLength),
                               TextNormal, Bold);
-    Column = Indentation + WordLength;
+    Column = WordWrapIndentation + WordLength;
     Wrapped = true;
   }
 


        


More information about the cfe-commits mailing list