This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by OikawaKirie on Feb 22 2021, 9:57 PM.

Details

Reviewers
mehdi_amini
Summary

Split from 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.

Diff Detail

Event Timeline

OikawaKirie created this revision.Feb 22 2021, 9:57 PM
OikawaKirie requested review of this revision.Feb 22 2021, 9:57 PM

This one might be better just fix the FIXME in linkCombinedIndex since assert won't do anything in the release build.

Maybe instead of logAllUnhandledErrors, just report_fatal_error in linkCombindedIndex()? Then we should not get a nullptr from the function.