[Lldb-commits] [lldb] [lldb] Fix string truncation method when substring is the prefix of string (NFC) (PR #94785)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 26 09:37:30 PDT 2024
================
@@ -287,7 +287,7 @@ Status PlatformAndroid::DownloadModuleSlice(const FileSpec &src_file_spec,
static constexpr llvm::StringLiteral k_zip_separator("!/");
size_t pos = source_file.find(k_zip_separator);
if (pos != std::string::npos)
- source_file = source_file.substr(0, pos);
+ source_file = source_file.resize(0, pos);
----------------
clayborg wrote:
`std::string::resize()` returns `void` so this won't even compile. The right fix is:
```
source_file.resize(pos);
```
https://github.com/llvm/llvm-project/pull/94785
More information about the lldb-commits
mailing list