[PATCH] D47989: [llvm-readobj] Add -string-dump (-p) option

Paul Semel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 15 07:21:53 PDT 2018


paulsemel added inline comments.


================
Comment at: tools/llvm-readobj/ELFDumper.cpp:3226
+                                         StringRef SectionName) {
+  char *StrPtr;
+  long SectionIndex = strtol(SectionName.data(), &StrPtr, 10);
----------------
echristo wrote:
> dblaikie wrote:
> > echristo wrote:
> > > Dave: Here.
> > @echristo (neat - you can tag people in comments :) ) - yeah, looked around a bit in LLVM to see if we had something & nothing stood out (admittedly it's possible the function doesn't have "parseInt" as a substring - though all our actual (asm of various flavours/contexts, linker scripts, etc) parsers do have that in the name, but they're hand rolled for better error handling or supporting different radix prefixes, etc).
> > 
> > Seems C++11 has this for std::string: http://en.cppreference.com/w/cpp/string/basic_string/stol - but if you want to parse a chunk of characters not necessarily in a std::string, you might be out of luck for something more modern until C++17: http://en.cppreference.com/w/cpp/utility/from_chars
> Oh well :)
> 
> Thanks @dblaikie!
Thank you for reviewing @dblaikie @echristo 


Repository:
  rL LLVM

https://reviews.llvm.org/D47989





More information about the llvm-commits mailing list