From a7a36dfdb6583fb2bb469d3b9403a8c380a4d0ff Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 29 Sep 2009 19:42:55 +0000 Subject: Introduce ObjCProtocolListType type subclass. This is used only for keeping detailed type source information for protocol references, it should not participate in the semantics of the type system. Its protocol list is not canonicalized. llvm-svn: 83093 --- clang/lib/Frontend/PCHReader.cpp | 10 ++++++++++ clang/lib/Frontend/PCHWriter.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) (limited to 'clang/lib/Frontend') diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index 73c0b8d9911..ead00ee75ff 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/lib/Frontend/PCHReader.cpp @@ -1970,6 +1970,16 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { Protos.push_back(cast(GetDecl(Record[Idx++]))); return Context->getObjCObjectPointerType(OIT, Protos.data(), NumProtos); } + + case pch::TYPE_OBJC_PROTOCOL_LIST: { + unsigned Idx = 0; + QualType OIT = GetType(Record[Idx++]); + unsigned NumProtos = Record[Idx++]; + llvm::SmallVector Protos; + for (unsigned I = 0; I != NumProtos; ++I) + Protos.push_back(cast(GetDecl(Record[Idx++]))); + return Context->getObjCProtocolListType(OIT, Protos.data(), NumProtos); + } } // Suppress a GCC warning return QualType(); diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp index 8ef846f7672..08a1661e1d3 100644 --- a/clang/lib/Frontend/PCHWriter.cpp +++ b/clang/lib/Frontend/PCHWriter.cpp @@ -255,6 +255,15 @@ PCHTypeWriter::VisitObjCObjectPointerType(const ObjCObjectPointerType *T) { Code = pch::TYPE_OBJC_OBJECT_POINTER; } +void PCHTypeWriter::VisitObjCProtocolListType(const ObjCProtocolListType *T) { + Writer.AddTypeRef(T->getBaseType(), Record); + Record.push_back(T->getNumProtocols()); + for (ObjCProtocolListType::qual_iterator I = T->qual_begin(), + E = T->qual_end(); I != E; ++I) + Writer.AddDeclRef(*I, Record); + Code = pch::TYPE_OBJC_PROTOCOL_LIST; +} + //===----------------------------------------------------------------------===// // PCHWriter Implementation //===----------------------------------------------------------------------===// @@ -425,6 +434,7 @@ void PCHWriter::WriteBlockInfoBlock() { RECORD(TYPE_ENUM); RECORD(TYPE_OBJC_INTERFACE); RECORD(TYPE_OBJC_OBJECT_POINTER); + RECORD(TYPE_OBJC_PROTOCOL_LIST); // Statements and Exprs can occur in the Types block. AddStmtsExprs(Stream, Record); -- cgit v1.2.3