[PATCH] D82173: [DWARFYAML][debug_info] Use 'AbbrCode' to index the abbreviation.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 19 04:17:18 PDT 2020
grimar added inline comments.
================
Comment at: llvm/lib/ObjectYAML/DWARFVisitor.cpp:59
+ // TODO: Add error handling and test this error.
+ assert(AbbrCode <= DebugInfo.AbbrevDecls.size());
+ auto &Abbrev = DebugInfo.AbbrevDecls[AbbrCode - 1];
----------------
Doesn't seem this assert is helpful. `AbbrevDecls` is `std::vector<Abbrev>`,
Most (or all) of STL implementations check the out of bounds access internally I think.
Probably you should add a test case and do the following for now:
```
if (AbbrCode > DebugInfo.AbbrevDecls.size())
report_fatal_error(...)
```
================
Comment at: llvm/lib/ObjectYAML/DWARFVisitor.cpp:60
+ assert(AbbrCode <= DebugInfo.AbbrevDecls.size());
+ auto &Abbrev = DebugInfo.AbbrevDecls[AbbrCode - 1];
auto FormVal = Entry.Values.begin();
----------------
Since you are touching this line, could you convert the `auto` to an actual type?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82173/new/
https://reviews.llvm.org/D82173
More information about the llvm-commits
mailing list