[PATCH] D157203: [symbolizer][NFC] Reorganize parsing input binary file

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 17:49:44 PDT 2023


ikudrin accepted this revision.
ikudrin added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp:213-214
     }
   } else {
-    ModuleName = BinaryName.str();
+    if (BinaryName.empty() && BuildID.empty()) {
+      // No input file is specified. If the input string contains at least two
----------------
Use `else if` here to reduce the nesting.


================
Comment at: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp:217-221
+      StringRef Name = getSpaceDelimitedWord(InputString);
+      if (Name.empty() || InputString.empty())
+        // No input filename is specified.
+        return false;
+      ModuleName = Name;
----------------
The new code has a different result than the old one if, for example, `InputString` consists of only one word, i.e. `ModuleName` was set to this word, while with the changed code it remains empty.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157203



More information about the llvm-commits mailing list