[llvm-profgen] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointers are dereferenced immediately, so assert the cast is correct instead of returning nullptr
This commit is contained in:
Simon Pilgrim 2022-02-02 13:18:10 +00:00
parent 9fd9d56dc6
commit c56a85fde0
1 changed files with 2 additions and 2 deletions

View File

@ -211,9 +211,9 @@ void ProfiledBinary::load() {
if (!DebugBinaryPath.empty()) { if (!DebugBinaryPath.empty()) {
OwningBinary<Binary> DebugPath = OwningBinary<Binary> DebugPath =
unwrapOrError(createBinary(DebugBinaryPath), DebugBinaryPath); unwrapOrError(createBinary(DebugBinaryPath), DebugBinaryPath);
loadSymbolsFromDWARF(*dyn_cast<ObjectFile>(DebugPath.getBinary())); loadSymbolsFromDWARF(*cast<ObjectFile>(DebugPath.getBinary()));
} else { } else {
loadSymbolsFromDWARF(*dyn_cast<ObjectFile>(&ExeBinary)); loadSymbolsFromDWARF(*cast<ObjectFile>(&ExeBinary));
} }
// Disassemble the text sections. // Disassemble the text sections.