Preserve address space information through member accesses, e.g.,  
   __attribute__((address_space(1))) struct {int arr[ 3 ]; }  *p1;
   ... = p1->arr[2];  // load from address space 1


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76717 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGValue.h b/lib/CodeGen/CGValue.h
index 820e1bd..9e93708 100644
--- a/lib/CodeGen/CGValue.h
+++ b/lib/CodeGen/CGValue.h
@@ -163,7 +163,8 @@
   // objective-c's gc attributes
   unsigned ObjCType : 2;  
 
-  
+  // address space
+  unsigned AddressSpace;
 
 private:
   static void SetQualifiers(unsigned Qualifiers, LValue& R) {
@@ -195,7 +196,9 @@
   bool isGlobalObjCRef() const { return GlobalObjCRef; }
   bool isObjCWeak() const { return ObjCType == Weak; }
   bool isObjCStrong() const { return ObjCType == Strong; }
-  
+
+  unsigned getAddressSpace() const { return AddressSpace; }
+
   static void SetObjCIvar(LValue& R, bool iValue) {
     R.Ivar = iValue;
   }
@@ -254,11 +257,13 @@
   }
 
   static LValue MakeAddr(llvm::Value *V, unsigned Qualifiers,
-                         QualType::GCAttrTypes GCAttrs = QualType::GCNone) {
+                         QualType::GCAttrTypes GCAttrs = QualType::GCNone,
+                         unsigned AddressSpace = 0) {
     LValue R;
     R.LVType = Simple;
     R.V = V;
     SetQualifiers(Qualifiers,R);
+    R.AddressSpace = AddressSpace;
     SetObjCType(GCAttrs, R);
     return R;
   }