This is an archive of the discontinued LLVM Phabricator instance.

[lldb][NFC] Replace most uses of StringConvert in LLDB with LLVM's to_integer
Needs ReviewPublic

Authored by teemperor on Jun 23 2020, 7:22 AM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

This replaces most uses of LLDB's own String to int/float conversion implementation with
LLVM's to_integer. The only remaining code in LLDB that now still uses StringConvert is
debugserver which can't use LLVM code, so I'll leave that part for a future commit.

Unlike the other StringConvert patch this doesn't try to add any missing error handling
but just does a NFC refactoring to to_integer.

Diff Detail

Event Timeline

teemperor created this revision.Jun 23 2020, 7:22 AM
teemperor edited the summary of this revision. (Show Details)Jun 23 2020, 7:24 AM
teemperor marked an inline comment as done.Jun 23 2020, 7:27 AM
teemperor added inline comments.
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
1508

Just to get ahead of people pointing this c_str() call out: This is just used as we keep inserting null terminators into the value string (as a replacement for doing substr()), so we actually only want to pass this new substring to to_integer and not all of value. I'll clean this (and the similar code below) up in a follow-up patch.

shafik added a subscriber: shafik.Jun 23 2020, 11:39 AM
shafik added inline comments.
lldb/source/Interpreter/OptionValueArray.cpp
209

I am curious why we are using size_t here but it looks like we are using uint32_t in other places.

lldb/source/Interpreter/OptionValueFileSpecList.cpp
132

We use uint32_t to hold the result of m_current_value.GetSize() above, but size_t here.

These should be consistent.

lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
4643

Should this be LLDB_INVALID_ADDRESS?

JDevlieghere added inline comments.Jun 24 2020, 10:06 AM
lldb/source/Host/common/Socket.cpp
286

Consider inlining the call?