diff options
author | Steve Naroff <snaroff@apple.com> | 2008-07-25 17:57:26 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-07-25 17:57:26 +0000 |
commit | 394f3f483fa4e7b472630cfcd03f7840520958c5 (patch) | |
tree | cd875ebb42ff560ca5b4613caa52ab0791db68c4 /lib/Sema/SemaDecl.cpp | |
parent | 684b9d2d159da52bc858d81bc53a38db7958a158 (diff) |
Move fix in r54013 from the parser to sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54032 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 25d4ad5751..4d726cf0a8 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1576,12 +1576,13 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, DeclTy *D) { Sema::DeclTy *Sema::ActOnFinishFunctionBody(DeclTy *D, StmtTy *Body) { Decl *dcl = static_cast<Decl *>(D); - if (FunctionDecl *FD = dyn_cast<FunctionDecl>(dcl)) { + if (FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(dcl)) { FD->setBody((Stmt*)Body); assert(FD == getCurFunctionDecl() && "Function parsing confused"); - } else if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(dcl)) { + } else if (ObjCMethodDecl *MD = dyn_cast_or_null<ObjCMethodDecl>(dcl)) { MD->setBody((Stmt*)Body); - } + } else + return 0; PopDeclContext(); // Verify and clean out per-function state. |