Minor refactoring of foreach's semantics code per Chris's suggetion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45604 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaStmt.cpp b/Sema/SemaStmt.cpp
index a983036..81eb0b0 100644
--- a/Sema/SemaStmt.cpp
+++ b/Sema/SemaStmt.cpp
@@ -540,15 +540,15 @@
Stmt *Body = static_cast<Stmt*>(body);
QualType FirstType;
if (DeclStmt *DS = dyn_cast_or_null<DeclStmt>(First)) {
- FirstType = dyn_cast<ValueDecl>(DS->getDecl())->getType();
+ FirstType = cast<ValueDecl>(DS->getDecl())->getType();
// C99 6.8.5p3: The declaration part of a 'for' statement shall only declare
// identifiers for objects having storage class 'auto' or 'register'.
for (ScopedDecl *D = DS->getDecl(); D; D = D->getNextDeclarator()) {
- BlockVarDecl *BVD = dyn_cast<BlockVarDecl>(D);
+ BlockVarDecl *BVD = cast<BlockVarDecl>(D);
if (BVD && !BVD->hasLocalStorage())
BVD = 0;
if (BVD == 0)
- return Diag(dyn_cast<ScopedDecl>(D)->getLocation(),
+ return Diag(cast<ScopedDecl>(D)->getLocation(),
diag::err_non_variable_decl_in_for);
}
}