]> granicus.if.org Git - clang/commitdiff
PCH support for ExtQualType
authorDouglas Gregor <dgregor@apple.com>
Wed, 15 Apr 2009 22:00:08 +0000 (22:00 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 15 Apr 2009 22:00:08 +0000 (22:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69230 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PCHReader.cpp
test/PCH/types.c
test/PCH/types.h

index e5656d63f93154c9c163fdc14eb76a6f2a385ba4..0bd254f1ca812a7daa0ec7b181663adebd545313 100644 (file)
@@ -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");
index 425305c584258dfd591a8556238680d382f62399..d3ed8475fd7bfe5dac98aafa322ccecf38138330 100644 (file)
@@ -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
index 54ab2152d7e7886d94032c103b4dc2e691a45b6d..fbf83c9ce8c813e9e22e3e48992b2af4acc7e0c2 100644 (file)
@@ -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