diff options
author | Steve Naroff <snaroff@apple.com> | 2009-06-17 22:40:22 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-06-17 22:40:22 +0000 |
commit | d1b3c2dd5bc1f3103bee6137957aa7c5f8f2f0bc (patch) | |
tree | bf881ac0ed3011c28fb1c773d8507d7022f9d85a /lib/Frontend | |
parent | c87813824896a7124d2dd1c08e4661bbe119abf5 (diff) |
First step toward fixing <rdar://problem/6613046> refactor clang objc type representation.
Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType).
This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types).
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73649 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r-- | lib/Frontend/PCHReader.cpp | 6 | ||||
-rw-r--r-- | lib/Frontend/PCHWriter.cpp | 10 | ||||
-rw-r--r-- | lib/Frontend/RewriteBlocks.cpp | 2 | ||||
-rw-r--r-- | lib/Frontend/RewriteObjC.cpp | 2 |
4 files changed, 12 insertions, 8 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 8ea917c3e3..3ba1f80e40 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -1729,13 +1729,15 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { return Context->getObjCQualifiedInterfaceType(ItfD, Protos.data(), NumProtos); } - case pch::TYPE_OBJC_QUALIFIED_ID: { + case pch::TYPE_OBJC_OBJECT_POINTER: { unsigned Idx = 0; + ObjCInterfaceDecl *ItfD = + cast_or_null<ObjCInterfaceDecl>(GetDecl(Record[Idx++])); unsigned NumProtos = Record[Idx++]; llvm::SmallVector<ObjCProtocolDecl*, 4> Protos; for (unsigned I = 0; I != NumProtos; ++I) Protos.push_back(cast<ObjCProtocolDecl>(GetDecl(Record[Idx++]))); - return Context->getObjCQualifiedIdType(Protos.data(), NumProtos); + return Context->getObjCObjectPointerType(ItfD, Protos.data(), NumProtos); } } // Suppress a GCC warning diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp index 765fecbf85..3b1eb080f2 100644 --- a/lib/Frontend/PCHWriter.cpp +++ b/lib/Frontend/PCHWriter.cpp @@ -229,12 +229,14 @@ PCHTypeWriter::VisitObjCQualifiedInterfaceType( Code = pch::TYPE_OBJC_QUALIFIED_INTERFACE; } -void PCHTypeWriter::VisitObjCQualifiedIdType(const ObjCQualifiedIdType *T) { +void +PCHTypeWriter::VisitObjCObjectPointerType(const ObjCObjectPointerType *T) { + Writer.AddDeclRef(T->getDecl(), Record); Record.push_back(T->getNumProtocols()); - for (ObjCQualifiedIdType::qual_iterator I = T->qual_begin(), + for (ObjCInterfaceType::qual_iterator I = T->qual_begin(), E = T->qual_end(); I != E; ++I) Writer.AddDeclRef(*I, Record); - Code = pch::TYPE_OBJC_QUALIFIED_ID; + Code = pch::TYPE_OBJC_OBJECT_POINTER; } //===----------------------------------------------------------------------===// @@ -407,7 +409,7 @@ void PCHWriter::WriteBlockInfoBlock() { RECORD(TYPE_ENUM); RECORD(TYPE_OBJC_INTERFACE); RECORD(TYPE_OBJC_QUALIFIED_INTERFACE); - RECORD(TYPE_OBJC_QUALIFIED_ID); + RECORD(TYPE_OBJC_OBJECT_POINTER); // Statements and Exprs can occur in the Types block. AddStmtsExprs(Stream, Record); diff --git a/lib/Frontend/RewriteBlocks.cpp b/lib/Frontend/RewriteBlocks.cpp index 8393574d1e..d20d5cd152 100644 --- a/lib/Frontend/RewriteBlocks.cpp +++ b/lib/Frontend/RewriteBlocks.cpp @@ -132,7 +132,7 @@ public: if (const PointerType *PT = OCT->getAsPointerType()) { if (isa<ObjCInterfaceType>(PT->getPointeeType()) || - isa<ObjCQualifiedIdType>(PT->getPointeeType())) + PT->getPointeeType()->isObjCQualifiedIdType()) return true; } return false; diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index f382704014..dce271070e 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -356,7 +356,7 @@ namespace { if (const PointerType *PT = OCT->getAsPointerType()) { if (isa<ObjCInterfaceType>(PT->getPointeeType()) || - isa<ObjCQualifiedIdType>(PT->getPointeeType())) + PT->getPointeeType()->isObjCQualifiedIdType()) return true; } return false; |