Update to use new PointerType::getUnqual() api.

llvm-svn: 45081
diff --git a/clang/CodeGen/CGBuiltin.cpp b/clang/CodeGen/CGBuiltin.cpp
index 8668e4e..89ca831 100644
--- a/clang/CodeGen/CGBuiltin.cpp
+++ b/clang/CodeGen/CGBuiltin.cpp
@@ -113,7 +113,8 @@
   case Builtin::BI__builtin_va_start:
   case Builtin::BI__builtin_va_end: {
     Value *ArgValue = EmitScalarExpr(E->getArg(0));
-    const llvm::Type *DestType = llvm::PointerType::get(llvm::Type::Int8Ty);
+    const llvm::Type *DestType = 
+      llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
     if (ArgValue->getType() != DestType)
       ArgValue = Builder.CreateBitCast(ArgValue, DestType, 
                                        ArgValue->getNameStart());
diff --git a/clang/CodeGen/CGExpr.cpp b/clang/CodeGen/CGExpr.cpp
index ab5d059..8d136bc 100644
--- a/clang/CodeGen/CGExpr.cpp
+++ b/clang/CodeGen/CGExpr.cpp
@@ -83,7 +83,7 @@
   switch (E->getStmtClass()) {
   default: {
     WarnUnsupported(E, "l-value expression");
-    llvm::Type *Ty = llvm::PointerType::get(ConvertType(E->getType()));
+    llvm::Type *Ty = llvm::PointerType::getUnqual(ConvertType(E->getType()));
     return LValue::MakeAddr(llvm::UndefValue::get(Ty));
   }
 
@@ -220,11 +220,13 @@
   assert(Src.isScalar() && "Can't emit an agg store with this method");
   // FIXME: Handle volatility etc.
   const llvm::Type *SrcTy = Src.getScalarVal()->getType();
-  const llvm::Type *AddrTy = 
-    cast<llvm::PointerType>(DstAddr->getType())->getElementType();
+  const llvm::PointerType *DstPtr = cast<llvm::PointerType>(DstAddr->getType());
+  const llvm::Type *AddrTy = DstPtr->getElementType();
+  unsigned AS = DstPtr->getAddressSpace();
   
   if (AddrTy != SrcTy)
-    DstAddr = Builder.CreateBitCast(DstAddr, llvm::PointerType::get(SrcTy),
+    DstAddr = Builder.CreateBitCast(DstAddr, 
+                                    llvm::PointerType::get(SrcTy, AS),
                                     "storetmp");
   Builder.CreateStore(Src.getScalarVal(), DstAddr);
 }
@@ -422,7 +424,10 @@
     const llvm::PointerType * BaseTy = 
       cast<llvm::PointerType>(BaseValue->getType());
     if (FieldTy != BaseTy->getElementType()) {
-      V = Builder.CreateBitCast(V, llvm::PointerType::get(FieldTy), "tmp");
+      // FIXME: Need to get address space qualification of pointer
+      V = Builder.CreateBitCast(V, 
+                                llvm::PointerType::getUnqual(FieldTy), 
+                                "tmp");
     }
   }
   return LValue::MakeAddr(V);
diff --git a/clang/CodeGen/CGExprAgg.cpp b/clang/CodeGen/CGExprAgg.cpp
index 1d60a86..969995c 100644
--- a/clang/CodeGen/CGExprAgg.cpp
+++ b/clang/CodeGen/CGExprAgg.cpp
@@ -92,7 +92,7 @@
   assert(!Ty->isComplexType() && "Shouldn't happen for complex");
   
   // Aggregate assignment turns into llvm.memcpy.
-  const llvm::Type *BP = llvm::PointerType::get(llvm::Type::Int8Ty);
+  const llvm::Type *BP = llvm::PointerType::getUnqual(llvm::Type::Int8Ty);
   if (DestPtr->getType() != BP)
     DestPtr = Builder.CreateBitCast(DestPtr, BP, "tmp");
   if (SrcPtr->getType() != BP)
diff --git a/clang/CodeGen/CodeGenModule.cpp b/clang/CodeGen/CodeGenModule.cpp
index 2df1877..ea908d3 100644
--- a/clang/CodeGen/CodeGenModule.cpp
+++ b/clang/CodeGen/CodeGenModule.cpp
@@ -75,7 +75,7 @@
   }
   
   // If the pointer type matches, just return it.
-  llvm::Type *PFTy = llvm::PointerType::get(Ty);
+  llvm::Type *PFTy = llvm::PointerType::getUnqual(Ty);
   if (PFTy == F->getType()) return Entry = F;
     
   // If this isn't a definition, just return it casted to the right type.
@@ -132,7 +132,7 @@
   }
   
   // If the pointer type matches, just return it.
-  llvm::Type *PTy = llvm::PointerType::get(Ty);
+  llvm::Type *PTy = llvm::PointerType::getUnqual(Ty);
   if (PTy == GV->getType()) return Entry = GV;
   
   // If this isn't a definition, just return it casted to the right type.
diff --git a/clang/CodeGen/CodeGenTypes.cpp b/clang/CodeGen/CodeGenTypes.cpp
index 54cc8b1..cc40af8 100644
--- a/clang/CodeGen/CodeGenTypes.cpp
+++ b/clang/CodeGen/CodeGenTypes.cpp
@@ -178,11 +178,11 @@
   }
   case Type::Pointer: {
     const PointerType &P = cast<PointerType>(Ty);
-    return llvm::PointerType::get(ConvertType(P.getPointeeType())); 
+    return llvm::PointerType::getUnqual(ConvertType(P.getPointeeType())); 
   }
   case Type::Reference: {
     const ReferenceType &R = cast<ReferenceType>(Ty);
-    return llvm::PointerType::get(ConvertType(R.getReferenceeType()));
+    return llvm::PointerType::getUnqual(ConvertType(R.getReferenceeType()));
   }
     
   case Type::VariableArray: {
@@ -224,7 +224,7 @@
     
     // Struct return passes the struct byref.
     if (!ResultType->isFirstClassType() && ResultType != llvm::Type::VoidTy) {
-      const llvm::Type *RType = llvm::PointerType::get(ResultType);
+      const llvm::Type *RType = llvm::PointerType::getUnqual(ResultType);
       QualType RTy = Context.getPointerType(FP.getResultType());
       TypeHolderMap.insert(std::make_pair(RTy.getTypePtr(), 
                                           llvm::PATypeHolder(RType)));
@@ -355,7 +355,7 @@
       ArgTys.push_back(Ty);
     else {
       QualType PTy = Context.getPointerType(FTP.getArgType(i));
-      const llvm::Type *PtrTy = llvm::PointerType::get(Ty);
+      const llvm::Type *PtrTy = llvm::PointerType::getUnqual(Ty);
       TypeHolderMap.insert(std::make_pair(PTy.getTypePtr(), 
                                           llvm::PATypeHolder(PtrTy)));