aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ASTWriterDecl.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
commite6e48b1490fe79ca8d44718e48f8644a28efa097 (patch)
tree5a6249e5bdcfbd786cbf68de755aca1c133a7e92 /clang/lib/Serialization/ASTWriterDecl.cpp
parent01fb1135d66125f02111f04273684d25d73d2645 (diff)
downloadllvm-e6e48b1490fe79ca8d44718e48f8644a28efa097.zip
llvm-e6e48b1490fe79ca8d44718e48f8644a28efa097.tar.gz
llvm-e6e48b1490fe79ca8d44718e48f8644a28efa097.tar.bz2
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()). llvm-svn: 147408
Diffstat (limited to 'clang/lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriterDecl.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index 0692c02..f139485 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -519,16 +519,23 @@ void ASTDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) {
void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
VisitObjCContainerDecl(D);
Record.push_back(D->isInitiallyForwardDecl());
- Record.push_back(D->isForwardDecl());
+ Record.push_back(D->isForwardProtoDecl);
Writer.AddSourceLocation(D->getLocEnd(), Record);
- Record.push_back(D->protocol_size());
- for (ObjCProtocolDecl::protocol_iterator
- I = D->protocol_begin(), IEnd = D->protocol_end(); I != IEnd; ++I)
- Writer.AddDeclRef(*I, Record);
- for (ObjCProtocolDecl::protocol_loc_iterator PL = D->protocol_loc_begin(),
- PLEnd = D->protocol_loc_end();
- PL != PLEnd; ++PL)
- Writer.AddSourceLocation(*PL, Record);
+
+ ObjCProtocolDecl *Def = D->getDefinition();
+ Writer.AddDeclRef(Def, Record);
+
+ if (D == Def) {
+ Record.push_back(D->protocol_size());
+ for (ObjCProtocolDecl::protocol_iterator
+ I = D->protocol_begin(), IEnd = D->protocol_end(); I != IEnd; ++I)
+ Writer.AddDeclRef(*I, Record);
+ for (ObjCProtocolDecl::protocol_loc_iterator PL = D->protocol_loc_begin(),
+ PLEnd = D->protocol_loc_end();
+ PL != PLEnd; ++PL)
+ Writer.AddSourceLocation(*PL, Record);
+ }
+
Code = serialization::DECL_OBJC_PROTOCOL;
}