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
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp
index 6704505..fe70494 100644
--- a/lib/AST/ASTImporter.cpp
+++ b/lib/AST/ASTImporter.cpp
@@ -3119,7 +3119,7 @@
}
ObjCProtocolDecl *ToProto = MergeWithProtocol;
- if (!ToProto || ToProto->isForwardDecl()) {
+ if (!ToProto || !ToProto->hasDefinition()) {
if (!ToProto) {
ToProto = ObjCProtocolDecl::Create(Importer.getToContext(), DC,
Name.getAsIdentifierInfo(), Loc,
@@ -3127,9 +3127,12 @@
D->isInitiallyForwardDecl());
ToProto->setLexicalDeclContext(LexicalDC);
LexicalDC->addDeclInternal(ToProto);
- if (D->isInitiallyForwardDecl() && !D->isForwardDecl())
+ if (D->isInitiallyForwardDecl() && D->hasDefinition())
ToProto->completedForwardDecl();
}
+ if (!ToProto->hasDefinition())
+ ToProto->startDefinition();
+
Importer.Imported(D, ToProto);
// Import protocols