diff options
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index f71f4f4b78..79f1e2d682 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -22,8 +22,11 @@ using namespace clang; /// and user declared, in the method definition's AST. void Sema::ObjCActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) { assert(getCurMethodDecl() == 0 && "Method parsing confused"); - ObjCMethodDecl *MDecl = dyn_cast<ObjCMethodDecl>(static_cast<Decl *>(D)); - assert(MDecl != 0 && "Not a method declarator!"); + ObjCMethodDecl *MDecl = dyn_cast_or_null<ObjCMethodDecl>((Decl *)D); + + // If we don't have a valid method decl, simply return. + if (!MDecl) + return; // Allow the rest of sema to find private method decl implementations. if (MDecl->isInstance()) |