[Lldb-commits] [PATCH] Fix FileSpec::GetPath to return null-terminated strings

Zachary Turner zturner at google.com
Thu Feb 26 09:44:35 PST 2015


================
Comment at: source/Host/macosx/HostInfoMacOSX.mm:137-139
@@ -136,4 +136,5 @@
         return false;
-    char raw_path[PATH_MAX];
-    lldb_file_spec.GetPath(raw_path, sizeof(raw_path));
+    std::string raw_path_str = lldb_file_spec.GetPath();
+    llvm::SmallString<PATH_MAX> raw_path(llvm::StringRef(raw_path_str.c_str(), raw_path_str.size()));
+    llvm::StringRef raw_path_ref = raw_path.str();
 
----------------
I know I suggested to use llvm::SmallString and StringRef in a post to the mailing list.  However, the outcome of that wasn't a total agreement, so for the time being I would suggest sticking with regular C++ strings.  To that end, I would delete the second 2 lines here and just operate on raw_path_str, and adjust the following code accordingly.

http://reviews.llvm.org/D7553

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list