[Lldb-commits] [PATCH] D152331: [lldb][NFCI] Platforms should own their SDKBuild and SDKRootDirectory strings

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 13 12:20:04 PDT 2023


JDevlieghere added inline comments.


================
Comment at: lldb/include/lldb/Interpreter/OptionGroupPlatform.h:52
 
-  void SetSDKRootDirectory(ConstString sdk_root_directory) {
-    m_sdk_sysroot = sdk_root_directory;
+  void SetSDKRootDirectory(llvm::StringRef sdk_root_directory) {
+    m_sdk_sysroot = sdk_root_directory.str();
----------------
bulbazord wrote:
> JDevlieghere wrote:
> > This should take a std::string by value and move it.
> Is there a specific reason you want to do that instead of using `llvm::StringRef::str()`?
Yes, it saves a copy when calling `SetSDKRootDirectory` with an rvalue reference or a moved std::string. There's no downside if you're going to store it as a std::string anyway. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152331/new/

https://reviews.llvm.org/D152331



More information about the lldb-commits mailing list