From: Daniel Dunbar Date: Thu, 26 Feb 2009 19:48:14 +0000 (+0000) Subject: Change PointersToResolve to list the pointee type to resolve, not the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6aeae7fa9cfaacba3a4077d62c01c2531d88a63e;p=clang Change PointersToResolve to list the pointee type to resolve, not the pointer type. - Drops use of PointerLikeType. - No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65566 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp index 47ac79f70b..1458ccd91b 100644 --- a/lib/CodeGen/CodeGenTypes.cpp +++ b/lib/CodeGen/CodeGenTypes.cpp @@ -85,13 +85,13 @@ const llvm::Type *CodeGenTypes::ConvertType(QualType T) { // circular types. Loop through all these defered pointees, if any, and // resolve them now. while (!PointersToResolve.empty()) { - std::pair P = + std::pair 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 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { ConvertTypeRecursive(cast(Ty).getElementType()); return llvm::StructType::get(EltTy, EltTy, NULL); } - case Type::Reference: + case Type::Reference: { + const ReferenceType &RTy = cast(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(Ty); + const PointerType &PTy = cast(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()); } diff --git a/lib/CodeGen/CodeGenTypes.h b/lib/CodeGen/CodeGenTypes.h index 3070c85260..9c548ec099 100644 --- a/lib/CodeGen/CodeGenTypes.h +++ b/lib/CodeGen/CodeGenTypes.h @@ -85,7 +85,7 @@ class CodeGenTypes { const llvm::TargetData& TheTargetData; mutable const ABIInfo* TheABIInfo; - llvm::SmallVector, 8> PointersToResolve; llvm::DenseMap TagDeclTypes;