Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Very easy fix for this as suggested in code changes and this will be good to go
lldb/source/Plugins/Platform/Android/PlatformAndroid.h | ||
---|---|---|
73 | Using the "SP" suffix is for std::shared_ptr, "UP" is for unique pointers. |
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | ||
---|---|---|
213 | GetAdbClient() calls make_unique which can fail. You'll want to add some checks when using all the adb objects in this file. | |
lldb/source/Plugins/Platform/Android/PlatformAndroid.h | ||
73 | SP -> shared_ptr. Was this supposed to be std::shared_ptr? If it's supposed to be a unique_ptr, you probably want AdbClientUP. | |
74 | I feel a little strange about this one because it's possible to create 2 AdbClients from the same PlatformAndroid ID, both are unique pointers and essentially do the same thing. Maybe PlatformAndroid can own an AdbClient that it vends through GetAdbClient? |
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | ||
---|---|---|
213 | will do! | |
lldb/source/Plugins/Platform/Android/PlatformAndroid.h | ||
73 | @bulbazord @clayborg thanks, and oops didn't realize UP. will fix. | |
74 | Yes, it's a bit strange how PlatformAndroid currently uses AdbClient. But, the scope of this diff is to unblock us first to write PlatformAndroid unittest with gmock + virtual. We will revisit for the structure change later. |
- s/AdbClientSP/AdbClientUP/g
- Updated Status &error arg to GetAdbClient
- Added error checks in AndroidPlatform for GetAdbClient
- Added DownloadModuleSliceWithAdbClientError test for the GetAdbClient error
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | ||
---|---|---|
204 | Do we want the PlatformAndroid object to have a member variable that stores the AdbClientUP as a member variable so we don't need to recreate this all the time? If the object isn't expensive to create and destroy, no worries, but if it is, then we might want to have a member variable | |
402 | We could cache the AdbClient object and return just a pointer here. The idea would be to have a member variable in PlatformAndroid object and then return just a "AdbClient *" from this function. This would stop us from creating and destroying a AdbClient object each time this is called. |
Lets get this patch in so we have testing. We can work on caching the AdbClient internally in an ivar of PlatformAndroid in follow up patches.
I will submit a diff to deal with how to use the AdbClient in PlatformAndroid later. Most likely we could use only one instance of AdbClient.
clang-format not found in user’s local PATH; not linting file.