Don't dereference a dyn_cast<> result - use cast<> instead. NFCI.

We were relying on the dyn_cast<> succeeding - better use cast<> and have it assert that its the correct type than dereference a null result.
This commit is contained in:
Simon Pilgrim 2020-11-08 13:06:07 +00:00
parent 0fe91ad463
commit 8930032f53
1 changed files with 1 additions and 1 deletions

View File

@ -372,7 +372,7 @@ void CodeGenModule::checkAliases() {
for (const GlobalDecl &GD : Aliases) {
StringRef MangledName = getMangledName(GD);
llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
auto *Alias = dyn_cast<llvm::GlobalIndirectSymbol>(Entry);
auto *Alias = cast<llvm::GlobalIndirectSymbol>(Entry);
Alias->replaceAllUsesWith(llvm::UndefValue::get(Alias->getType()));
Alias->eraseFromParent();
}