diff options
-rw-r--r-- | lib/Frontend/PCHReader.cpp | 18 | ||||
-rw-r--r-- | test/PCH/types.c | 13 | ||||
-rw-r--r-- | test/PCH/types.h | 4 |
3 files changed, 27 insertions, 8 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index e5656d63f9..0bd254f1ca 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -1079,10 +1079,20 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { assert(false && "Should never jump to an attribute block"); return QualType(); - case pch::TYPE_EXT_QUAL: - // FIXME: Deserialize ExtQualType - assert(false && "Cannot deserialize qualified types yet"); - return QualType(); + case pch::TYPE_EXT_QUAL: { + assert(Record.size() == 3 && + "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; + } case pch::TYPE_FIXED_WIDTH_INT: { assert(Record.size() == 2 && "Incorrect encoding of fixed-width int type"); diff --git a/test/PCH/types.c b/test/PCH/types.c index 425305c584..d3ed8475fd 100644 --- a/test/PCH/types.c +++ b/test/PCH/types.c @@ -5,7 +5,16 @@ // RUN: clang-cc -emit-pch -fblocks -o %t %S/types.h && // RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -verify %s -// FIXME: TYPE_EXT_QUAL +typedef int INT; +INT int_value; + +__attribute__((address_space(1))) int int_as_one; + +// TYPE_EXT_QUAL +ASInt *as_int_ptr1 = &int_value; // expected-error{{different address spaces}} \ + // FIXME: expected-warning{{discards qualifiers}} +ASInt *as_int_ptr2 = &int_as_one; + // FIXME: TYPE_FIXED_WIDTH_INT // TYPE_COMPLEX @@ -13,8 +22,6 @@ _Complex float Cfloat_val; Cfloat *Cfloat_ptr = &Cfloat_val; // TYPE_POINTER -typedef int INT; -INT int_value; int_ptr int_value_ptr = &int_value; // TYPE_BLOCK_POINTER diff --git a/test/PCH/types.h b/test/PCH/types.h index 54ab2152d7..fbf83c9ce8 100644 --- a/test/PCH/types.h +++ b/test/PCH/types.h @@ -1,6 +1,8 @@ /* Used with the types.c test */ -// FIXME: TYPE_EXT_QUAL +// TYPE_EXT_QUAL +typedef __attribute__((address_space(1))) int ASInt; + // FIXME: TYPE_FIXED_WIDTH_INT // TYPE_COMPLEX |