This is an archive of the discontinued LLVM Phabricator instance.

Refactor cast<>'s in if conditionals, which can only assert on failure.
ClosedPublic

Authored by hintonda on Mar 18 2019, 6:35 PM.

Details

Summary

This patch refactors several instances of cast<> used in if
conditionals. Since cast<> asserts on failure, the else branch can
never be taken.

In some cases, the fix is to replace cast<> with dyn_cast<>. While
others required the removal of the conditional and some minor
refactoring.

A discussion can be seen here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190318/265044.html

Diff Detail

Repository
rC Clang

Event Timeline

hintonda created this revision.Mar 18 2019, 6:35 PM
Herald added a reviewer: shafik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
rjmccall accepted this revision.Mar 18 2019, 9:34 PM

LGTM, thanks!

This revision is now accepted and ready to land.Mar 18 2019, 9:34 PM
This revision was automatically updated to reflect the committed changes.