aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-15 18:03:09 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-15 18:03:09 +0000
commit53df7a1d34f21d8f2309311d1067d463e9064c60 (patch)
treec656cd7d7c1bd60325bd76cf1cae70defd8f970c /lib/AST/DeclBase.cpp
parent7ab8ef99e6b9064861b8d786a40560d74f96b421 (diff)
Introduce the core infrastructure needed to model a complete
redeclaration chain for Objective-C classes, including: - Using the first declaration as the canonical declaration. - Using the definition as the primary DeclContext - Making sure that all declarations have a pointer to the definition data, and the definition knows that it is the definition. - Serialization support for when a definition gets added to a declaration that comes from an AST file. However, note that we're not taking advantage of much of this code yet, because we're still re-using ObjCInterfaceDecls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r--lib/AST/DeclBase.cpp9
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: