Skip to content

Commit

Permalink
[llvm] Add assertions for the smart pointers with the possibility to …
Browse files Browse the repository at this point in the history
…be null in DWARFLinker::loadClangModule

Split from D91844.

The local variable `Unit` in function `DWARFLinker::loadClangModule`
in file `llvm/lib/DWARFLinker/DWARFLinker.cpp`. If the variable is not set
in the loop below its definition, it will trigger a null pointer dereference
after the loop.

Patch By: OikawaKirie

Reviewed By: avl

Differential Revision: https://reviews.llvm.org/D97185
  • Loading branch information
Snape3058 authored and avl-llvm committed Feb 27, 2021
1 parent 1d4a2f3 commit df6fb4d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/DWARFLinker/DWARFLinker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2131,6 +2131,7 @@ Error DWARFLinker::loadClangModule(
Unit->markEverythingAsKept();
}
}
assert(Unit && "CompileUnit is not set!");
if (!Unit->getOrigUnit().getUnitDIE().hasChildren())
return Error::success();
if (!Quiet && Options.Verbose) {
Expand Down

0 comments on commit df6fb4d

Please sign in to comment.