This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Add assertions for the smart pointers with the possibility to be null in ModuleLazyLoaderCache::operator()
ClosedPublic

Authored by OikawaKirie on Feb 22 2021, 10:37 PM.

Details

Summary

Split from D91844.

The return value of function ModuleLazyLoaderCache::operator() in file llvm/tools/llvm-link/llvm-link.cpp. According to the bug report of my static analyzer, the std::function variable ModuleLazyLoaderCache::createLazyModule points to function loadFile, which may return nullptr when error. And the pointer is dereferenced without a check.

Diff Detail

Event Timeline

OikawaKirie requested review of this revision.Feb 22 2021, 10:37 PM
OikawaKirie created this revision.
This revision is now accepted and ready to land.Feb 23 2021, 7:51 AM

If the revision is done, please commit it on my behalf. Thank you.

Ella Ma <alansnape3058@gmail.com>