[PATCH] D97185: [llvm] Add assertions for the smart pointers with the possibility to be null in DWARFLinker::loadClangModule
Ella Ma via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 22 00:52:10 PST 2021
OikawaKirie created this revision.
OikawaKirie added a reviewer: avl.
OikawaKirie added a project: LLVM.
Herald added a subscriber: hiraditya.
OikawaKirie requested review of this revision.
Herald added a subscriber: llvm-commits.
Split from D91844 <https://reviews.llvm.org/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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97185
Files:
llvm/lib/DWARFLinker/DWARFLinker.cpp
Index: llvm/lib/DWARFLinker/DWARFLinker.cpp
===================================================================
--- llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -2131,6 +2131,7 @@
Unit->markEverythingAsKept();
}
}
+ assert(Unit && "CompileUnit is not set!");
if (!Unit->getOrigUnit().getUnitDIE().hasChildren())
return Error::success();
if (!Quiet && Options.Verbose) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97185.325387.patch
Type: text/x-patch
Size: 433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210222/ca74ca19/attachment.bin>
More information about the llvm-commits
mailing list