diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-16 15:02:53 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-16 15:02:53 +0000 |
commit | 18df52bbb5d28ca082064d31ae7558dbdae52377 (patch) | |
tree | da96cdc09ffa80f698f06b6f071b5da751a88c4d /lib/Frontend/PCHReaderDecl.cpp | |
parent | 2e331b938b38057e333fab0ba841130ea8467794 (diff) |
Keep track of the source locations for each protocol reference in
Objective-C classes, protocol definitions, forward protocol
declarations, and categories. This information isn't actually used
yet; that's coming next.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReaderDecl.cpp')
-rw-r--r-- | lib/Frontend/PCHReaderDecl.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp index 69343ed48c..138ad8226f 100644 --- a/lib/Frontend/PCHReaderDecl.cpp +++ b/lib/Frontend/PCHReaderDecl.cpp @@ -223,7 +223,12 @@ void PCHDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) { Protocols.reserve(NumProtocols); for (unsigned I = 0; I != NumProtocols; ++I) Protocols.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++]))); - ID->setProtocolList(Protocols.data(), NumProtocols, *Reader.getContext()); + llvm::SmallVector<SourceLocation, 16> ProtoLocs; + ProtoLocs.reserve(NumProtocols); + for (unsigned I = 0; I != NumProtocols; ++I) + ProtoLocs.push_back(SourceLocation::getFromRawEncoding(Record[Idx++])); + ID->setProtocolList(Protocols.data(), NumProtocols, ProtoLocs.data(), + *Reader.getContext()); unsigned NumIvars = Record[Idx++]; llvm::SmallVector<ObjCIvarDecl *, 16> IVars; IVars.reserve(NumIvars); @@ -253,7 +258,12 @@ void PCHDeclReader::VisitObjCProtocolDecl(ObjCProtocolDecl *PD) { ProtoRefs.reserve(NumProtoRefs); for (unsigned I = 0; I != NumProtoRefs; ++I) ProtoRefs.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++]))); - PD->setProtocolList(ProtoRefs.data(), NumProtoRefs, *Reader.getContext()); + llvm::SmallVector<SourceLocation, 16> ProtoLocs; + ProtoLocs.reserve(NumProtoRefs); + for (unsigned I = 0; I != NumProtoRefs; ++I) + ProtoLocs.push_back(SourceLocation::getFromRawEncoding(Record[Idx++])); + PD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(), + *Reader.getContext()); } void PCHDeclReader::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *FD) { @@ -282,7 +292,12 @@ void PCHDeclReader::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *FPD) { ProtoRefs.reserve(NumProtoRefs); for (unsigned I = 0; I != NumProtoRefs; ++I) ProtoRefs.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++]))); - FPD->setProtocolList(ProtoRefs.data(), NumProtoRefs, *Reader.getContext()); + llvm::SmallVector<SourceLocation, 16> ProtoLocs; + ProtoLocs.reserve(NumProtoRefs); + for (unsigned I = 0; I != NumProtoRefs; ++I) + ProtoLocs.push_back(SourceLocation::getFromRawEncoding(Record[Idx++])); + FPD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(), + *Reader.getContext()); } void PCHDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) { @@ -293,7 +308,12 @@ void PCHDeclReader::VisitObjCCategoryDecl(ObjCCategoryDecl *CD) { ProtoRefs.reserve(NumProtoRefs); for (unsigned I = 0; I != NumProtoRefs; ++I) ProtoRefs.push_back(cast<ObjCProtocolDecl>(Reader.GetDecl(Record[Idx++]))); - CD->setProtocolList(ProtoRefs.data(), NumProtoRefs, *Reader.getContext()); + llvm::SmallVector<SourceLocation, 16> ProtoLocs; + ProtoLocs.reserve(NumProtoRefs); + for (unsigned I = 0; I != NumProtoRefs; ++I) + ProtoLocs.push_back(SourceLocation::getFromRawEncoding(Record[Idx++])); + CD->setProtocolList(ProtoRefs.data(), NumProtoRefs, ProtoLocs.data(), + *Reader.getContext()); CD->setNextClassCategory(cast_or_null<ObjCCategoryDecl>(Reader.GetDecl(Record[Idx++]))); CD->setLocEnd(SourceLocation::getFromRawEncoding(Record[Idx++])); } |