In the past I've advocated for use of StringRef::getAsInteger(). Sometimes this leads to awkward code, for example if you have a std::string you have to write StringRef(Str).getAsInteger().
Secondly, the return value is extremely confusing as it returns true on failure and false on success. I recently committed a function to llvm/ADT/StringExtras.h called to_integer which solves both of these problems. If you have a std::string S, you can call llvm::to_integer(S) and it just works. It also inverts the conditional so it now returns true on success and false on failure, which should be more intuitive. As a side benefit, the radix argument is also last instead of first, so it can take a default value. So you no longer have to pass 0 for the first argument to auto-detect. So I recommend using this function going forward. At some point in the future, I may even consider deleting getAsInteger() and all callers with this function.
_______________________________________________ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev