diff options
author | John McCall <rjmccall@apple.com> | 2009-09-24 19:53:00 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-09-24 19:53:00 +0000 |
commit | 8ccfcb51ee020c4ca0e76838a2ef57cb5bb77914 (patch) | |
tree | 13ac964a39ac7c94d225bf75d6c92141cdfefbc2 /clang/lib/Frontend/PCHReader.cpp | |
parent | 6d98ede7e8511180699b41e12b2de5f979d8bb14 (diff) | |
download | bcm5719-llvm-8ccfcb51ee020c4ca0e76838a2ef57cb5bb77914.tar.gz bcm5719-llvm-8ccfcb51ee020c4ca0e76838a2ef57cb5bb77914.zip |
Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right; many more remain.
llvm-svn: 82705
Diffstat (limited to 'clang/lib/Frontend/PCHReader.cpp')
-rw-r--r-- | clang/lib/Frontend/PCHReader.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp index c493e39776b..73c0b8d9911 100644 --- a/clang/lib/Frontend/PCHReader.cpp +++ b/clang/lib/Frontend/PCHReader.cpp @@ -1764,18 +1764,11 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { unsigned Code = Stream.ReadCode(); switch ((pch::TypeCode)Stream.ReadRecord(Code, Record)) { case pch::TYPE_EXT_QUAL: { - assert(Record.size() == 3 && + assert(Record.size() == 2 && "Incorrect encoding of extended qualifier type"); QualType Base = GetType(Record[0]); - QualType::GCAttrTypes GCAttr = (QualType::GCAttrTypes)Record[1]; - unsigned AddressSpace = Record[2]; - - QualType T = Base; - if (GCAttr != QualType::GCNone) - T = Context->getObjCGCQualType(T, GCAttr); - if (AddressSpace) - T = Context->getAddrSpaceQualType(T, AddressSpace); - return T; + Qualifiers Quals = Qualifiers::fromOpaqueValue(Record[1]); + return Context->getQualifiedType(Base, Quals); } case pch::TYPE_FIXED_WIDTH_INT: { @@ -1984,8 +1977,8 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { QualType PCHReader::GetType(pch::TypeID ID) { - unsigned Quals = ID & 0x07; - unsigned Index = ID >> 3; + unsigned FastQuals = ID & Qualifiers::FastMask; + unsigned Index = ID >> Qualifiers::FastWidth; if (Index < pch::NUM_PREDEF_TYPE_IDS) { QualType T; @@ -2026,15 +2019,15 @@ QualType PCHReader::GetType(pch::TypeID ID) { } assert(!T.isNull() && "Unknown predefined type"); - return T.getQualifiedType(Quals); + return T.withFastQualifiers(FastQuals); } Index -= pch::NUM_PREDEF_TYPE_IDS; //assert(Index < TypesLoaded.size() && "Type index out-of-range"); - if (!TypesLoaded[Index]) - TypesLoaded[Index] = ReadTypeRecord(TypeOffsets[Index]).getTypePtr(); + if (TypesLoaded[Index].isNull()) + TypesLoaded[Index] = ReadTypeRecord(TypeOffsets[Index]); - return QualType(TypesLoaded[Index], Quals); + return TypesLoaded[Index].withFastQualifiers(FastQuals); } Decl *PCHReader::GetDecl(pch::DeclID ID) { @@ -2155,7 +2148,7 @@ void PCHReader::PrintStats() { unsigned NumTypesLoaded = TypesLoaded.size() - std::count(TypesLoaded.begin(), TypesLoaded.end(), - (Type *)0); + QualType()); unsigned NumDeclsLoaded = DeclsLoaded.size() - std::count(DeclsLoaded.begin(), DeclsLoaded.end(), (Decl *)0); |