[clang] eccd279 - [clang] Use SmallString::operator std::string() (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 18:40:01 PST 2024


Author: Kazu Hirata
Date: 2024-01-12T18:39:49-08:00
New Revision: eccd279979ac210248cdf7d583169df6a8e552bd

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

LOG: [clang] Use SmallString::operator std::string() (NFC)

Added: 
    

Modified: 
    clang/lib/Frontend/CompilerInstance.cpp
    clang/lib/Frontend/Rewrite/FrontendActions.cpp
    clang/tools/driver/driver.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 56bbef9697b650..6df5521b25cc08 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -2204,7 +2204,7 @@ void CompilerInstance::createModuleFromSource(SourceLocation ImportLoc,
   // Build the module, inheriting any modules that we've built locally.
   if (compileModuleImpl(*this, ImportLoc, ModuleName, Input, StringRef(),
                         ModuleFileName, PreBuildStep, PostBuildStep)) {
-    BuiltModules[std::string(ModuleName)] = std::string(ModuleFileName.str());
+    BuiltModules[std::string(ModuleName)] = std::string(ModuleFileName);
     llvm::sys::RemoveFileOnSignal(ModuleFileName);
   }
 }

diff  --git a/clang/lib/Frontend/Rewrite/FrontendActions.cpp b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
index 14569013b92ce9..92921bf6f3d7bd 100644
--- a/clang/lib/Frontend/Rewrite/FrontendActions.cpp
+++ b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
@@ -77,7 +77,7 @@ class FixItActionSuffixInserter : public FixItOptions {
     SmallString<128> Path(Filename);
     llvm::sys::path::replace_extension(Path,
       NewSuffix + llvm::sys::path::extension(Path));
-    return std::string(Path.str());
+    return std::string(Path);
   }
 };
 

diff  --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index a46d5169719bc9..1407c7fcdab769 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -64,7 +64,7 @@ std::string GetExecutablePath(const char *Argv0, bool CanonicalPrefixes) {
       if (llvm::ErrorOr<std::string> P =
               llvm::sys::findProgramByName(ExecutablePath))
         ExecutablePath = *P;
-    return std::string(ExecutablePath.str());
+    return std::string(ExecutablePath);
   }
 
   // This just needs to be some symbol in the binary; C++ doesn't


        


More information about the cfe-commits mailing list