diff options
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r-- | lib/AST/DeclBase.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index b7941506b0..024f370c56 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -779,9 +779,16 @@ DeclContext *DeclContext::getPrimaryContext() { return this; case Decl::ObjCInterface: + if (ObjCInterfaceDecl *Def = cast<ObjCInterfaceDecl>(this)->getDefinition()) + return Def; + + return this; + case Decl::ObjCProtocol: + // FIXME: Update when protocols properly model forward declarations. + // For now, it's fine to fall through + case Decl::ObjCCategory: - // FIXME: Can Objective-C interfaces be forward-declared? return this; case Decl::ObjCImplementation: |