Refactor cast<>'s in if conditionals, which can only assert on failure.
authorDon Hinton <hintonda@gmail.com>
Tue, 19 Mar 2019 06:14:14 +0000 (06:14 +0000)
committerDon Hinton <hintonda@gmail.com>
Tue, 19 Mar 2019 06:14:14 +0000 (06:14 +0000)
commitf170dff3c198290eda05272f7d4beb6f93b80168
treead3b27773845b321d8d08c9079cd847f053c3f95
parentc60bc94afcf77fa4487cec52ab5323a1f5469f5b
Refactor cast<>'s in if conditionals, which can only assert on failure.

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

Differential Revision: https://reviews.llvm.org/D59529

llvm-svn: 356441
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/DeclBase.cpp
clang/lib/CodeGen/CGExprConstant.cpp
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/lib/Sema/SemaOpenMP.cpp