Alternate address spaces work:

rename QualType::getQualifiers to getCVRQualifiers.
Add some fixme's and clean up some code relevant to qualifiers.
Change ASQualType to contain a Type* instead of a QualType.  
Any CVR qualifiers should be on the outer qual type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47398 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 31cdc59..3d60866 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -541,7 +541,7 @@
     // FIXME: Handle address space modifiers
     QualType MemberType = MemberDecl->getType();
     unsigned combinedQualifiers =
-        MemberType.getQualifiers() | BaseType.getQualifiers();
+        MemberType.getCVRQualifiers() | BaseType.getCVRQualifiers();
     MemberType = MemberType.getQualifiedType(combinedQualifiers);
 
     return new MemberExpr(BaseExpr, OpKind==tok::arrow, MemberDecl,
@@ -826,8 +826,8 @@
       // ignore qualifiers on void (C99 6.5.15p3, clause 6)
       if (lhptee->isVoidType() &&
           (rhptee->isObjectType() || rhptee->isIncompleteType())) {
-        // figure out necessary qualifiers (C99 6.5.15p6)
-        QualType destPointee = lhptee.getQualifiedType(rhptee.getQualifiers());
+        // Figure out necessary qualifiers (C99 6.5.15p6)
+        QualType destPointee=lhptee.getQualifiedType(rhptee.getCVRQualifiers());
         QualType destType = Context.getPointerType(destPointee);
         ImpCastExprToType(lex, destType); // add qualifiers if necessary
         ImpCastExprToType(rex, destType); // promote to void*
@@ -835,7 +835,7 @@
       }
       if (rhptee->isVoidType() &&
           (lhptee->isObjectType() || lhptee->isIncompleteType())) {
-        QualType destPointee = rhptee.getQualifiedType(lhptee.getQualifiers());
+        QualType destPointee=rhptee.getQualifiedType(lhptee.getCVRQualifiers());
         QualType destType = Context.getPointerType(destPointee);
         ImpCastExprToType(lex, destType); // add qualifiers if necessary
         ImpCastExprToType(rex, destType); // promote to void*
@@ -928,7 +928,8 @@
     //     b[4] = 1;
     //   }
     QualType ELT = ary->getElementType();
-    ELT = ELT.getQualifiedType(t.getQualifiers()|ELT.getQualifiers());
+    // FIXME: Handle ASQualType
+    ELT = ELT.getQualifiedType(t.getCVRQualifiers()|ELT.getCVRQualifiers());
     ImpCastExprToType(e, Context.getPointerType(ELT));
   }
 }
@@ -1114,8 +1115,9 @@
   // C99 6.5.16.1p1: This following citation is common to constraints 
   // 3 & 4 (below). ...and the type *pointed to* by the left has all the 
   // qualifiers of the type *pointed to* by the right; 
-  if ((lhptee.getQualifiers() & rhptee.getQualifiers()) != 
-       rhptee.getQualifiers())
+  // FIXME: Handle ASQualType
+  if ((lhptee.getCVRQualifiers() & rhptee.getCVRQualifiers()) != 
+       rhptee.getCVRQualifiers())
     ConvTy = CompatiblePointerDiscardsQualifiers;
 
   // C99 6.5.16.1p1 (constraint 4): If one operand is a pointer to an object or