[PATCH] D157210: [symbolizer] Change reaction on invalid input

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 12 02:04:49 PDT 2023


sepavloff added inline comments.


================
Comment at: llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h:36
   StringRef ModuleName;
-  std::optional<uint64_t> Address;
+  std::optional<uint64_t> Address = std::nullopt;
 };
----------------
MaskRay wrote:
> remove this change. 
> 
> https://en.cppreference.com/w/cpp/utility/optional/optional
> "1) Constructs an object that does not contain a value."
The initializer was added because of the warning^
```
export/serge/llvm/space2/llvm-project/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp:292:43: warning: missing field 'Address' initializer [-Wmissing-field-initializers]
          Request SymRequest = {ModuleName};
```
I added the second item to the initializer and removed the initializer in the struct declaration.


================
Comment at: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp:198
     if (Name.empty())
-      // Wrong name for module file.
-      return false;
+      return makeStringError("input file name is incorrect");
     if (HasBuildIDPrefix) {
----------------
MaskRay wrote:
> `cannot be empty` seems better than `is incorrect`
It is not for missing argument but for the case of unterminated strings:
```
$ cat sym.inp
FILE:"addr.exe 0x400540
$ ./llvm-symbolizer <sym.inp
$ ./llvm-symbolizer: error: 'FILE:"addr.exe 0x400540': input file name is incorrect
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157210



More information about the llvm-commits mailing list