From 7bbe03d8ae0772d89f6539d073dd43e49268a42c Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 30 Jun 2010 00:22:35 +0000 Subject: Revert r107173, "fix PR7519: after thrashing around and remembering how all this stuff", it broke bootstrap. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107232 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenTypes.cpp | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'lib/CodeGen/CodeGenTypes.cpp') diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp index 6ff394e03c..cf23c07394 100644 --- a/lib/CodeGen/CodeGenTypes.cpp +++ b/lib/CodeGen/CodeGenTypes.cpp @@ -46,7 +46,7 @@ CodeGenTypes::~CodeGenTypes() { const llvm::Type *CodeGenTypes::ConvertType(QualType T) { llvm::PATypeHolder Result = ConvertTypeRecursive(T); - // Any pointers that were converted deferred evaluation of their pointee type, + // Any pointers that were converted defered evaluation of their pointee type, // creating an opaque type instead. This is in order to avoid problems with // circular types. Loop through all these defered pointees, if any, and // resolve them now. @@ -284,8 +284,7 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { assert(A.getIndexTypeCVRQualifiers() == 0 && "FIXME: We only handle trivial array types so far!"); // int X[] -> [0 x int] - return llvm::ArrayType::get(ConvertTypeForMemRecursive(A.getElementType()), - 0); + return llvm::ArrayType::get(ConvertTypeForMemRecursive(A.getElementType()), 0); } case Type::ConstantArray: { const ConstantArrayType &A = cast(Ty); @@ -300,11 +299,7 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { } case Type::FunctionNoProto: case Type::FunctionProto: { - // First, check whether we can build the full function type. If the - // function type depends on an incomplete type (e.g. a struct or enum), we - // cannot lower the function type. Instead, turn it into an Opaque pointer - // and have UpdateCompletedType revisit the function type when/if the opaque - // argument type is defined. + // First, check whether we can build the full function type. if (const TagType *TT = VerifyFuncTypeComplete(&Ty)) { // This function's type depends on an incomplete tag type; make sure // we have an opaque type corresponding to the tag type. @@ -314,25 +309,17 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) { FunctionTypes.insert(std::make_pair(&Ty, ResultType)); return ResultType; } - // The function type can be built; call the appropriate routines to // build it. - const CGFunctionInfo *FI; - bool isVariadic; - if (const FunctionProtoType *FPT = dyn_cast(&Ty)) { - FI = &getFunctionInfo( - CanQual::CreateUnsafe(QualType(FPT, 0)), - true /*Recursive*/); - isVariadic = FPT->isVariadic(); - } else { - const FunctionNoProtoType *FNPT = cast(&Ty); - FI = &getFunctionInfo( - CanQual::CreateUnsafe(QualType(FNPT, 0)), - true /*Recursive*/); - isVariadic = true; - } - - return GetFunctionType(*FI, isVariadic); + if (const FunctionProtoType *FPT = dyn_cast(&Ty)) + return GetFunctionType(getFunctionInfo( + CanQual::CreateUnsafe(QualType(FPT,0))), + FPT->isVariadic()); + + const FunctionNoProtoType *FNPT = cast(&Ty); + return GetFunctionType(getFunctionInfo( + CanQual::CreateUnsafe(QualType(FNPT,0))), + true); } case Type::ObjCObject: -- cgit v1.2.3-18-g5258