Author: Kazu Hirata
Date: 2025-06-27T22:07:34-07:00
New Revision: 7f6d7391cfff6a444e5e15d1de9be429ff1d9edd

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

LOG: [Basic] Use StringRef::drop_back (NFC) (#146195)

Added: 
    

Modified: 
    clang/lib/Basic/FileManager.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 3bd7e0ca5bcd2..fc4ec785d3764 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -141,7 +141,7 @@ FileManager::getDirectoryRef(StringRef DirName, bool 
CacheFailure) {
   if (DirName.size() > 1 &&
       DirName != llvm::sys::path::root_path(DirName) &&
       llvm::sys::path::is_separator(DirName.back()))
-    DirName = DirName.substr(0, DirName.size()-1);
+    DirName = DirName.drop_back();
   std::optional<std::string> DirNameStr;
   if (is_style_windows(llvm::sys::path::Style::native)) {
     // Fixing a problem with "clang C:test.c" on Windows.


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to