[Lldb-commits] [PATCH] D146536: SymbolFile: ensure that we have a value before invoking `getBitWidth`

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 21 09:24:33 PDT 2023


sgraenitz added a comment.

Thanks for tackling this! Yes, I hit it as well during development and wondered what is the right thing to do. The effect of the proposed change will be log messages like this right?

  ... which resolves to a constant value of mismatched width (-1 bits). Ignoring constant.

I think it would be great to log the actual issue (constant width not accessible) and bail out if `value.Type == llvm::pdb::Empty`. Even before requesting `qual_type`. What do you think?



================
Comment at: lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp:1307
+        unsigned constant_width =
+            value.Type == llvm::pdb::Empty ? - 1 : value.getBitWidth();
 
----------------
Is the `-1` intended to express an invalid value? Maybe this should become a signed `int` then?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146536



More information about the lldb-commits mailing list