[PATCH] D97254: [llvm] Add assertions for the smart pointers with the possibility to be null returned from ThinLTOCodeGenerator::linkCombinedIndex

Ella Ma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 21:57:26 PST 2021


OikawaKirie created this revision.
OikawaKirie added a reviewer: mehdi_amini.
OikawaKirie added a project: LLVM.
Herald added subscribers: arphaman, steven_wu, hiraditya, inglorion.
OikawaKirie requested review of this revision.
Herald added a subscriber: llvm-commits.

Split from D91844 <https://reviews.llvm.org/D91844>.

The local variable `Index` in function `ThinLTOCodeGenerator::run` in file llvm/lib/LTO/ThinLTOCodeGenerator.cpp. When function `ThinLTOCodeGenerator::linkCombinedIndex` returns `nullptr`, the null smart pointer will be dereferenced below.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97254

Files:
  llvm/lib/LTO/ThinLTOCodeGenerator.cpp


Index: llvm/lib/LTO/ThinLTOCodeGenerator.cpp
===================================================================
--- llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -967,6 +967,7 @@
 
   // Sequential linking phase
   auto Index = linkCombinedIndex();
+  assert(Index);
 
   // Save temps: index.
   if (!SaveTempsDir.empty()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97254.325669.patch
Type: text/x-patch
Size: 364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210223/a301c395/attachment.bin>


More information about the llvm-commits mailing list