Replace misc. StringConvert uses with llvm::to_integer()
and llvm::to_float(), except for cases where further refactoring is
planned. The purpose of this change is to eliminate the StringConvert
API that is duplicate to LLVM, and less correct in behavior at the same
time.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This patch makes me very happy. I have one comment regarding one small change in behaviour, but otherwise this LGTM.
If you have the time, it would be nice to drop FIXME's above the few places where the return value of to_integer is not checked. Those always make great beginner bugs.
lldb/source/Symbol/SymbolContext.cpp | ||
---|---|---|
986 | This change and the one above make this return true on a parse failure. LLDB is of course one step ahead of us here and never even checks the return value anywhere (...), but I think it still makes sense to preserve the behaviour in this patch. |
Beginner? I'm pretty sure these things are really hard ;-).
That said, in most of the cases 'not checking the return value' is combined with setting a fallback value earlier, i.e. if llvm::to_integer() fails, the variable remains with its default/fallback value. But yeah, I suppose it would be nice to rethink these things and maybe add explicit error handling in place of silent fallbacks.
lldb/source/Symbol/SymbolContext.cpp | ||
---|---|---|
986 | Ahh, good catch. Will fix in a minute. |
This change and the one above make this return true on a parse failure. LLDB is of course one step ahead of us here and never even checks the return value anywhere (...), but I think it still makes sense to preserve the behaviour in this patch.