[Lldb-commits] [lldb] [lldb] Fix string truncation method when substring is the prefix of string (NFC) (PR #94785)
Shivam Gupta via lldb-commits
lldb-commits at lists.llvm.org
Sat Jul 6 02:00:31 PDT 2024
https://github.com/xgupta updated https://github.com/llvm/llvm-project/pull/94785
>From 6ec5b1a005b7551f2857b30e2461d297e7febfa3 Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivam98.tkg at gmail.com>
Date: Fri, 7 Jun 2024 23:44:49 +0530
Subject: [PATCH 1/2] [LLDB][NFC] Fix a cppcheck warning in
Platform/Android/PlatformAndroid.cpp
Fix #91211
---
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index e177c134fea20e..6367763dd8b4ac 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -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);
Status error;
AdbClientUP adb(GetAdbClient(error));
>From c05f1a9812b8ef6cfc4f1f4c2d7525371d65a95b Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivma98.tkg at gmail.com>
Date: Sat, 6 Jul 2024 11:00:16 +0200
Subject: [PATCH 2/2] address review comment
---
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
index 6367763dd8b4ac..ff63af68aec9db 100644
--- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -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.resize(0, pos);
+ source_file = source_file.resize(pos);
Status error;
AdbClientUP adb(GetAdbClient(error));
More information about the lldb-commits
mailing list