Use cast instead of dyn_cast in combination with llvm_unreachable.

llvm-svn: 233456
This commit is contained in:
Rui Ueyama 2015-03-28 00:09:26 +00:00
parent 667c152bce
commit 034f627838
1 changed files with 7 additions and 8 deletions

View File

@ -635,14 +635,13 @@ DefaultLayout<ELFT>::addAtom(const Atom *atom) {
}
return section->appendAtom(atom);
}
if (const AbsoluteAtom *absoluteAtom = dyn_cast<AbsoluteAtom>(atom)) {
// Absolute atoms are not part of any section, they are global for the whole
// link
_absoluteAtoms.push_back(new (_allocator)
lld::AtomLayout(absoluteAtom, 0, absoluteAtom->value()));
return _absoluteAtoms.back();
}
llvm_unreachable("Only absolute / defined atoms can be added here");
const AbsoluteAtom *absoluteAtom = cast<AbsoluteAtom>(atom);
// Absolute atoms are not part of any section, they are global for the whole
// link
_absoluteAtoms.push_back(
new (_allocator) lld::AtomLayout(absoluteAtom, 0, absoluteAtom->value()));
return _absoluteAtoms.back();
}
/// Output sections with the same name into a OutputSection