[llvm] d9f2960 - [NFC] Correctly assert the indents for printEnumValHelpStr.

Joachim Meyer via llvm-commits llvm-commits at lists.llvm.org
Fri May 7 05:27:59 PDT 2021


Author: Joachim Meyer
Date: 2021-05-07T14:30:43+02:00
New Revision: d9f2960c932c9803e662098e33d899efa3c67f44

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

LOG: [NFC] Correctly assert the indents for printEnumValHelpStr.

Only verify that there's no negative indent.
Noted by @chapuni in https://reviews.llvm.org/D93494.

Reviewed By: chapuni

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

Added: 
    

Modified: 
    llvm/lib/Support/CommandLine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index cdd8ec286cd67..0cc82739798df 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -1739,7 +1739,7 @@ void Option::printHelpStr(StringRef HelpStr, size_t Indent,
 void Option::printEnumValHelpStr(StringRef HelpStr, size_t BaseIndent,
                                  size_t FirstLineIndentedBy) {
   const StringRef ValHelpPrefix = "  ";
-  assert(BaseIndent >= FirstLineIndentedBy + ValHelpPrefix.size());
+  assert(BaseIndent >= FirstLineIndentedBy);
   std::pair<StringRef, StringRef> Split = HelpStr.split('\n');
   outs().indent(BaseIndent - FirstLineIndentedBy)
       << ArgHelpPrefix << ValHelpPrefix << Split.first << "\n";


        


More information about the llvm-commits mailing list