aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-01 19:29:29 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-01 19:29:29 +0000
commit5e2a1ff9f28d2eab256d2553e76a9c9d54693875 (patch)
tree9b6a413be6f25d57bd1e0737cb63227d337493e5 /lib/AST/DeclObjC.cpp
parent27b7ce6199bfd008ba8d10c8bd91d926e2274df3 (diff)
Move the data that corresponds to the definition of a protocol into a
separately-allocated DefinitionData structure. Introduce various functions that will help with the separation of declarations from definitions (isThisDeclarationADefinition(), hasDefinition(), getDefinition()). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r--lib/AST/DeclObjC.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 75100ecb3c..f5828fcb4c 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -1003,9 +1003,19 @@ ObjCMethodDecl *ObjCProtocolDecl::lookupMethod(Selector Sel,
return NULL;
}
+void ObjCProtocolDecl::allocateDefinitionData() {
+ assert(!Data && "Protocol already has a definition!");
+ Data = new (getASTContext()) DefinitionData;
+}
+
+void ObjCProtocolDecl::startDefinition() {
+ allocateDefinitionData();
+}
+
void ObjCProtocolDecl::completedForwardDecl() {
- assert(isForwardDecl() && "Only valid to call for forward refs");
+ assert(!hasDefinition() && "Only valid to call for forward refs");
isForwardProtoDecl = false;
+ startDefinition();
if (ASTMutationListener *L = getASTContext().getASTMutationListener())
L->CompletedObjCForwardRef(this);
}