[PATCH] D86691: [analyzer] Fix wrong parameter name in printFormattedEntry

Yang Fan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 27 01:56:13 PDT 2020


nullptr.cpp created this revision.
nullptr.cpp added reviewers: dcoughlin, NoQ, xazax.hun, Szelethus.
Herald added subscribers: cfe-commits, ASDenysPetrov, martong, Charusso, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware.
Herald added a project: clang.
nullptr.cpp requested review of this revision.

Function `printFormattedEntry` has declaration:

  static void printFormattedEntry(
      llvm::raw_ostream &Out,
      std::pair<StringRef, StringRef> EntryDescPair,
      size_t EntryWidth, size_t InitialPad, size_t MinLineWidth = 0);

But in its definition:

  void AnalyzerOptions::printFormattedEntry(
      llvm::raw_ostream &Out,
      std::pair<StringRef, StringRef> EntryDescPair,
      size_t InitialPad, size_t EntryWidth, size_t MinLineWidth) {

`EntryWidth` and `InitialPad` have different position.

The definition code and all `printFormattedEntry`'s usages use the same
position as the definition, so fix the wrong parameter name in declaration.
Also fix some errors in the comments and make the comments clearer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86691

Files:
  clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp


Index: clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
+++ clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
@@ -40,7 +40,7 @@
   const size_t PadForDesc = InitialPad + EntryWidth;
 
   FOut.PadToColumn(InitialPad) << EntryDescPair.first;
-  // If the buffer's length is greater then PadForDesc, print a newline.
+  // If the buffer's length is greater than PadForDesc, print a newline.
   if (FOut.getColumn() > PadForDesc)
     FOut << '\n';
 
Index: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
===================================================================
--- clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -177,23 +177,23 @@
   /// description in a formatted manner. If \p MinLineWidth is set to 0, no line
   /// breaks are introduced for the description.
   ///
-  /// Format, depending whether the option name's length is less then
-  /// \p OptionWidth:
+  /// Format, depending whether the option name's length is less than
+  /// \p EntryWidth:
   ///
   ///   <padding>EntryName<padding>Description
   ///   <---------padding--------->Description
   ///   <---------padding--------->Description
   ///
-  ///   <padding>VeryVeryLongOptionName
+  ///   <padding>VeryVeryLongEntryName
   ///   <---------padding--------->Description
   ///   <---------padding--------->Description
-  ///   ^~~~~~~~ InitialPad
-  ///   ^~~~~~~~~~~~~~~~~~~~~~~~~~ EntryWidth
+  ///   ^~~~~~~~~InitialPad
+  ///            ^~~~~~~~~~~~~~~~~~EntryWidth
   ///   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~MinLineWidth
-  static void printFormattedEntry(
-      llvm::raw_ostream &Out,
-      std::pair<StringRef, StringRef> EntryDescPair,
-      size_t EntryWidth, size_t InitialPad, size_t MinLineWidth = 0);
+  static void printFormattedEntry(llvm::raw_ostream &Out,
+                                  std::pair<StringRef, StringRef> EntryDescPair,
+                                  size_t InitialPad, size_t EntryWidth,
+                                  size_t MinLineWidth = 0);
 
   /// Pairs of checker/package name and enable/disable.
   std::vector<std::pair<std::string, bool>> CheckersAndPackages;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86691.288233.patch
Type: text/x-patch
Size: 2314 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200827/f2a72773/attachment.bin>


More information about the cfe-commits mailing list