[cfe-commits] r65566 - in /cfe/trunk/lib/CodeGen: CodeGenTypes.cpp CodeGenTypes.h

Daniel Dunbar daniel at zuster.org
Thu Feb 26 11:48:14 PST 2009


Author: ddunbar
Date: Thu Feb 26 13:48:14 2009
New Revision: 65566

URL: http://llvm.org/viewvc/llvm-project?rev=65566&view=rev
Log:
Change PointersToResolve to list the pointee type to resolve, not the
pointer type.
 - Drops use of PointerLikeType.
 - No intended functionality change.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
    cfe/trunk/lib/CodeGen/CodeGenTypes.h

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=65566&r1=65565&r2=65566&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Thu Feb 26 13:48:14 2009
@@ -85,13 +85,13 @@
   // circular types.  Loop through all these defered pointees, if any, and
   // resolve them now.
   while (!PointersToResolve.empty()) {
-    std::pair<const PointerLikeType *, llvm::OpaqueType*> P =
+    std::pair<QualType, llvm::OpaqueType*> P =
       PointersToResolve.back();
     PointersToResolve.pop_back();
     // We can handle bare pointers here because we know that the only pointers
     // to the Opaque type are P.second and from other types.  Refining the
     // opqaue type away will invalidate P.second, but we don't mind :).
-    const llvm::Type *NT = ConvertTypeRecursive(P.first->getPointeeType());
+    const llvm::Type *NT = ConvertTypeRecursive(P.first);
     P.second->refineAbstractTypeTo(NT);
   }
 
@@ -223,12 +223,18 @@
       ConvertTypeRecursive(cast<ComplexType>(Ty).getElementType());
     return llvm::StructType::get(EltTy, EltTy, NULL);
   }
-  case Type::Reference:
+  case Type::Reference: {
+    const ReferenceType &RTy = cast<ReferenceType>(Ty);
+    QualType ETy = RTy.getPointeeType();
+    llvm::OpaqueType *PointeeType = llvm::OpaqueType::get();
+    PointersToResolve.push_back(std::make_pair(ETy, PointeeType));
+    return llvm::PointerType::get(PointeeType, ETy.getAddressSpace());
+  }
   case Type::Pointer: {
-    const PointerLikeType &PTy = cast<PointerLikeType>(Ty);
+    const PointerType &PTy = cast<PointerType>(Ty);
     QualType ETy = PTy.getPointeeType();
     llvm::OpaqueType *PointeeType = llvm::OpaqueType::get();
-    PointersToResolve.push_back(std::make_pair(&PTy, PointeeType));
+    PointersToResolve.push_back(std::make_pair(ETy, PointeeType));
     return llvm::PointerType::get(PointeeType, ETy.getAddressSpace());
   }
     

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.h?rev=65566&r1=65565&r2=65566&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.h Thu Feb 26 13:48:14 2009
@@ -85,7 +85,7 @@
   const llvm::TargetData& TheTargetData;
   mutable const ABIInfo* TheABIInfo;
   
-  llvm::SmallVector<std::pair<const PointerLikeType *,
+  llvm::SmallVector<std::pair<QualType,
                               llvm::OpaqueType *>, 8>  PointersToResolve;
 
   llvm::DenseMap<const Type*, llvm::PATypeHolder> TagDeclTypes;





More information about the cfe-commits mailing list