[clang] 249a21a - [clang-format] Remove useless npos parameter from substr. NFC.

Marek Kurdej via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 28 02:23:39 PST 2022


Author: Marek Kurdej
Date: 2022-01-28T11:23:29+01:00
New Revision: 249a21ab188419b019adea21716f5c779c063de3

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

LOG: [clang-format] Remove useless npos parameter from substr. NFC.

Added: 
    

Modified: 
    clang/lib/Format/BreakableToken.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp
index 5d03c9811e1b7..a91860faf74ec 100644
--- a/clang/lib/Format/BreakableToken.cpp
+++ b/clang/lib/Format/BreakableToken.cpp
@@ -254,8 +254,8 @@ unsigned
 BreakableStringLiteral::getRemainingLength(unsigned LineIndex, unsigned Offset,
                                            unsigned StartColumn) const {
   return UnbreakableTailLength + Postfix.size() +
-         encoding::columnWidthWithTabs(Line.substr(Offset, StringRef::npos),
-                                       StartColumn, Style.TabWidth, Encoding);
+         encoding::columnWidthWithTabs(Line.substr(Offset), StartColumn,
+                                       Style.TabWidth, Encoding);
 }
 
 unsigned BreakableStringLiteral::getContentStartColumn(unsigned LineIndex,
@@ -550,7 +550,7 @@ unsigned BreakableBlockComment::getRangeLength(unsigned LineIndex,
     // We never need a decoration when breaking just the trailing "*/" postfix.
     // Note that checking that Length == 0 is not enough, since Length could
     // also be StringRef::npos.
-    if (Content[LineIndex].substr(Offset, StringRef::npos).empty()) {
+    if (Content[LineIndex].substr(Offset).empty()) {
       LineLength -= Decoration.size();
     }
   }


        


More information about the cfe-commits mailing list