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
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 69fcacf..f084a03 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -10901,7 +10901,7 @@
     for (NamedDecl *D : ULE->decls()) {
       if (D == PrevD)
         Lookups.push_back(UnresolvedSet<8>());
-      else if (auto *DRD = cast<OMPDeclareReductionDecl>(D))
+      else if (auto *DRD = dyn_cast<OMPDeclareReductionDecl>(D))
         Lookups.back().addDecl(DRD);
       PrevD = D;
     }