[clang] 2b3baff - [Analysis] Use StringRef::rtrim (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 17:24:53 PST 2024


Author: Kazu Hirata
Date: 2024-01-08T17:24:47-08:00
New Revision: 2b3baffb4720d4ddc7ddd7080f5ea624230b9324

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

LOG: [Analysis] Use StringRef::rtrim (NFC)

Added: 
    

Modified: 
    clang/lib/Analysis/PathDiagnostic.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp
index 0cb03943c547c3..79f337a91ec8fa 100644
--- a/clang/lib/Analysis/PathDiagnostic.cpp
+++ b/clang/lib/Analysis/PathDiagnostic.cpp
@@ -50,12 +50,7 @@
 using namespace clang;
 using namespace ento;
 
-static StringRef StripTrailingDots(StringRef s) {
-  for (StringRef::size_type i = s.size(); i != 0; --i)
-    if (s[i - 1] != '.')
-      return s.substr(0, i);
-  return {};
-}
+static StringRef StripTrailingDots(StringRef s) { return s.rtrim('.'); }
 
 PathDiagnosticPiece::PathDiagnosticPiece(StringRef s,
                                          Kind k, DisplayHint hint)


        


More information about the cfe-commits mailing list