summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReaderDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-15 18:17:48 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-15 18:17:48 +0000
commit3a5ae564b8bb06f79c215526357eea5f213b78a6 (patch)
treeee5051d1576b66ceb3203880057ae89abd15c657 /clang/lib/Serialization/ASTReaderDecl.cpp
parentc03c52ea017aa470a05e12fe2a7fda91a2e22e3a (diff)
downloadbcm5719-llvm-3a5ae564b8bb06f79c215526357eea5f213b78a6.tar.gz
bcm5719-llvm-3a5ae564b8bb06f79c215526357eea5f213b78a6.zip
Now that deserializing a definition of a C++ class/Objective-C
class/Objective-C protocol suffices get all of the redeclarations of that declaration wired to the definition, we no longer need to record the identity of the definition in every declaration. Instead, just record a bit to indicate whether a particular declaration is the definition. llvm-svn: 148224
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r--clang/lib/Serialization/ASTReaderDecl.cpp33
1 files changed, 8 insertions, 25 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index 863aabb1734..8becd35d546 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -103,10 +103,6 @@ namespace clang {
void ReadCXXDefinitionData(struct CXXRecordDecl::DefinitionData &Data,
const RecordData &R, unsigned &I);
- void InitializeCXXDefinitionData(CXXRecordDecl *D,
- CXXRecordDecl *DefinitionDecl,
- const RecordData &Record, unsigned &Idx);
-
/// \brief RAII class used to capture the first ID within a redeclaration
/// chain and to introduce it into the list of pending redeclaration chains
/// on destruction.
@@ -672,8 +668,7 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) {
TypeIDForTypeDecl = Reader.getGlobalTypeID(F, Record[Idx++]);
mergeRedeclarable(ID, Redecl);
- ObjCInterfaceDecl *Def = ReadDeclAs<ObjCInterfaceDecl>(Record, Idx);
- if (ID == Def) {
+ if (Record[Idx++]) {
// Read the definition.
ID->allocateDefinitionData();
@@ -745,8 +740,7 @@ void ASTDeclReader::VisitObjCProtocolDecl(ObjCProtocolDecl *PD) {
VisitObjCContainerDecl(PD);
mergeRedeclarable(PD, Redecl);
- ObjCProtocolDecl *Def = ReadDeclAs<ObjCProtocolDecl>(Record, Idx);
- if (PD == Def) {
+ if (Record[Idx++]) {
// Read the definition.
PD->allocateDefinitionData();
@@ -1104,13 +1098,11 @@ void ASTDeclReader::ReadCXXDefinitionData(
Data.FirstFriend = ReadDeclAs<FriendDecl>(Record, Idx);
}
-void ASTDeclReader::InitializeCXXDefinitionData(CXXRecordDecl *D,
- CXXRecordDecl *DefinitionDecl,
- const RecordData &Record,
- unsigned &Idx) {
- ASTContext &C = Reader.getContext();
+void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) {
+ VisitRecordDecl(D);
- if (D == DefinitionDecl) {
+ ASTContext &C = Reader.getContext();
+ if (Record[Idx++]) {
D->DefinitionData = new (C) struct CXXRecordDecl::DefinitionData(D);
// Propagate the DefinitionData pointer to the canonical declaration, so
@@ -1119,24 +1111,15 @@ void ASTDeclReader::InitializeCXXDefinitionData(CXXRecordDecl *D,
D->getCanonicalDecl()->DefinitionData = D->DefinitionData;
ReadCXXDefinitionData(*D->DefinitionData, Record, Idx);
-
+
// Note that we have deserialized a definition. Any declarations
// deserialized before this one will be be given the DefinitionData pointer
// at the end.
Reader.PendingDefinitions.insert(D);
} else {
// Propagate DefinitionData pointer from the canonical declaration.
- D->DefinitionData = D->getCanonicalDecl()->DefinitionData;
+ D->DefinitionData = D->getCanonicalDecl()->DefinitionData;
}
-}
-
-void ASTDeclReader::VisitCXXRecordDecl(CXXRecordDecl *D) {
- VisitRecordDecl(D);
-
- CXXRecordDecl *DefinitionDecl = ReadDeclAs<CXXRecordDecl>(Record, Idx);
- InitializeCXXDefinitionData(D, DefinitionDecl, Record, Idx);
-
- ASTContext &C = Reader.getContext();
enum CXXRecKind {
CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization
OpenPOWER on IntegriCloud