diff options
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 7675d5a9d6..7cc3029aae 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2897,21 +2897,22 @@ Sema::DeclPtrTy Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclPtrTy D) { } static bool StatementCreatesScope(Stmt* S) { - DeclStmt *DS = dyn_cast<DeclStmt>(S); - if (DS == 0) return false; - for (DeclStmt::decl_iterator I = DS->decl_begin(), E = DS->decl_end(); - I != E; ++I) { - if (VarDecl *D = dyn_cast<VarDecl>(*I)) { - if (D->getType()->isVariablyModifiedType() || - D->hasAttr<CleanupAttr>()) - return true; - } else if (TypedefDecl *D = dyn_cast<TypedefDecl>(*I)) { - if (D->getUnderlyingType()->isVariablyModifiedType()) - return true; + if (DeclStmt *DS = dyn_cast<DeclStmt>(S)) { + for (DeclStmt::decl_iterator I = DS->decl_begin(), E = DS->decl_end(); + I != E; ++I) { + if (VarDecl *D = dyn_cast<VarDecl>(*I)) { + if (D->getType()->isVariablyModifiedType() || + D->hasAttr<CleanupAttr>()) + return true; + } else if (TypedefDecl *D = dyn_cast<TypedefDecl>(*I)) { + if (D->getUnderlyingType()->isVariablyModifiedType()) + return true; + } } + } else if (isa<ObjCAtTryStmt>(S)) { + return true; } - return false; } |