[cfe-commits] r69230 - in /cfe/trunk: lib/Frontend/PCHReader.cpp test/PCH/types.c test/PCH/types.h

Douglas Gregor dgregor at apple.com
Wed Apr 15 15:00:09 PDT 2009


Author: dgregor
Date: Wed Apr 15 17:00:08 2009
New Revision: 69230

URL: http://llvm.org/viewvc/llvm-project?rev=69230&view=rev
Log:
PCH support for ExtQualType

Modified:
    cfe/trunk/lib/Frontend/PCHReader.cpp
    cfe/trunk/test/PCH/types.c
    cfe/trunk/test/PCH/types.h

Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=69230&r1=69229&r2=69230&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Wed Apr 15 17:00:08 2009
@@ -1079,10 +1079,20 @@
     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");

Modified: cfe/trunk/test/PCH/types.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/types.c?rev=69230&r1=69229&r2=69230&view=diff

==============================================================================
--- cfe/trunk/test/PCH/types.c (original)
+++ cfe/trunk/test/PCH/types.c Wed Apr 15 17:00:08 2009
@@ -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 @@
 Cfloat *Cfloat_ptr = &Cfloat_val;
 
 // TYPE_POINTER
-typedef int INT;
-INT int_value;
 int_ptr int_value_ptr = &int_value;
 
 // TYPE_BLOCK_POINTER

Modified: cfe/trunk/test/PCH/types.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/types.h?rev=69230&r1=69229&r2=69230&view=diff

==============================================================================
--- cfe/trunk/test/PCH/types.h (original)
+++ cfe/trunk/test/PCH/types.h Wed Apr 15 17:00:08 2009
@@ -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





More information about the cfe-commits mailing list