This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add assertions for the smart pointers with the possibility to be null in InMemoryFileSystem::addFile
Needs ReviewPublic

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

Details

Reviewers
ilya-biryukov
Summary

Split from D91844

The parameter variable Buffer in function InMemoryFileSystem::addFile in file llvm/lib/Support/VirtualFileSystem.cpp. The assertion in this function (assert(!(HardLinkTarget && Buffer))) only checks whether these two parameters can both be non-null. But It can be inferred that both pointers can be null together. A null Buffer pointer can be dereferenced without a check.

Diff Detail