[Lldb-commits] [lldb] e28d8f9 - [lldb] Replace SmallStr.str().str() with std::string conversion operator.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 29 21:34:27 PST 2020


Author: Jonas Devlieghere
Date: 2020-01-29T21:34:19-08:00
New Revision: e28d8f9069b92f5c20416c575f49727daf5adb1a

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

LOG: [lldb] Replace SmallStr.str().str() with std::string conversion operator.

Use the std::string conversion operator introduced in
d7049213d0fcda691c9e79f9b41e357198d99738. The SmallString in the log
statement doesn't require conversion at all when using the variadic log
macro.

Added: 
    

Modified: 
    lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
    lldb/unittests/Expression/CppModuleConfigurationTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
index 26fcb81de8de..8abb7e420575 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangHost.cpp
@@ -67,10 +67,10 @@ static bool DefaultComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,
     llvm::sys::path::native(relative_path);
     llvm::sys::path::append(clang_dir, relative_path);
     if (!verify || VerifyClangPath(clang_dir)) {
-      LLDB_LOGF(log,
-                "DefaultComputeClangResourceDir: Setting ClangResourceDir "
-                "to \"%s\", verify = %s",
-                clang_dir.str().str().c_str(), verify ? "true" : "false");
+      LLDB_LOG(log,
+               "DefaultComputeClangResourceDir: Setting ClangResourceDir "
+               "to \"{0}\", verify = {1}",
+               clang_dir.str(), verify ? "true" : "false");
       file_spec.GetDirectory().SetString(clang_dir);
       FileSystem::Instance().Resolve(file_spec);
       return true;

diff  --git a/lldb/unittests/Expression/CppModuleConfigurationTest.cpp b/lldb/unittests/Expression/CppModuleConfigurationTest.cpp
index 69d9a15e9c03..c3cc134bd5a3 100644
--- a/lldb/unittests/Expression/CppModuleConfigurationTest.cpp
+++ b/lldb/unittests/Expression/CppModuleConfigurationTest.cpp
@@ -28,7 +28,7 @@ static std::string ResourceInc() {
   llvm::SmallString<256> resource_dir;
   llvm::sys::path::append(resource_dir, GetClangResourceDir().GetPath(),
                           "include");
-  return resource_dir.str().str();
+  return std::string(resource_dir);
 }
 
 /// Utility function turningn a list of paths into a FileSpecList.


        


More information about the lldb-commits mailing list