[PATCH] D156978: [symbolizer][NFC] Move file argument parsing into separate function

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 21:27:47 PDT 2023


ikudrin added inline comments.


================
Comment at: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp:138
 
+static std::pair<std::string, StringRef>
+getSpaceDelimitedWord(StringRef Source) {
----------------
The function returns a part of its input, so there is no need to allocate new memory for that, `StringRef` is enough. It should be the responsibility of the caller to copy the result if necessary.

Also, the function can update `Source` if it is passed as a reference, which would simplify the code even more.


================
Comment at: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp:164
                          uint64_t &ModuleOffset) {
   const char kDelimiters[] = " \n\r";
   ModuleName = "";
----------------
It looks like `kDelimiters` can be removed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156978/new/

https://reviews.llvm.org/D156978



More information about the llvm-commits mailing list