[cfe-commits] r107232 - in /cfe/trunk: lib/CodeGen/CGCall.cpp lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/CodeGenTypes.h lib/CodeGen/TargetInfo.cpp test/CodeGen/decl.c

Daniel Dunbar daniel at zuster.org
Tue Jun 29 17:22:35 PDT 2010


Author: ddunbar
Date: Tue Jun 29 19:22:35 2010
New Revision: 107232

URL: http://llvm.org/viewvc/llvm-project?rev=107232&view=rev
Log:
Revert r107173, "fix PR7519: after thrashing around and remembering how all this stuff", it broke bootstrap.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
    cfe/trunk/lib/CodeGen/CodeGenTypes.h
    cfe/trunk/lib/CodeGen/TargetInfo.cpp
    cfe/trunk/test/CodeGen/decl.c

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=107232&r1=107231&r2=107232&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Jun 29 19:22:35 2010
@@ -61,31 +61,28 @@
 }
 
 const CGFunctionInfo &
-CodeGenTypes::getFunctionInfo(CanQual<FunctionNoProtoType> FTNP,
-                              bool IsRecursive) {
+CodeGenTypes::getFunctionInfo(CanQual<FunctionNoProtoType> FTNP) {
   return getFunctionInfo(FTNP->getResultType().getUnqualifiedType(),
                          llvm::SmallVector<CanQualType, 16>(),
-                         FTNP->getExtInfo(), IsRecursive);
+                         FTNP->getExtInfo());
 }
 
 /// \param Args - contains any initial parameters besides those
 ///   in the formal type
 static const CGFunctionInfo &getFunctionInfo(CodeGenTypes &CGT,
                                   llvm::SmallVectorImpl<CanQualType> &ArgTys,
-                                             CanQual<FunctionProtoType> FTP,
-                                             bool IsRecursive = false) {
+                                             CanQual<FunctionProtoType> FTP) {
   // FIXME: Kill copy.
   for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i)
     ArgTys.push_back(FTP->getArgType(i));
   CanQualType ResTy = FTP->getResultType().getUnqualifiedType();
-  return CGT.getFunctionInfo(ResTy, ArgTys, FTP->getExtInfo(), IsRecursive);
+  return CGT.getFunctionInfo(ResTy, ArgTys, FTP->getExtInfo());
 }
 
 const CGFunctionInfo &
-CodeGenTypes::getFunctionInfo(CanQual<FunctionProtoType> FTP,
-                              bool IsRecursive) {
+CodeGenTypes::getFunctionInfo(CanQual<FunctionProtoType> FTP) {
   llvm::SmallVector<CanQualType, 16> ArgTys;
-  return ::getFunctionInfo(*this, ArgTys, FTP, IsRecursive);
+  return ::getFunctionInfo(*this, ArgTys, FTP);
 }
 
 static CallingConv getCallingConventionForDecl(const Decl *D) {
@@ -218,8 +215,7 @@
 
 const CGFunctionInfo &CodeGenTypes::getFunctionInfo(CanQualType ResTy,
                            const llvm::SmallVectorImpl<CanQualType> &ArgTys,
-                                            const FunctionType::ExtInfo &Info,
-                                                    bool IsRecursive) {
+                                            const FunctionType::ExtInfo &Info) {
 #ifndef NDEBUG
   for (llvm::SmallVectorImpl<CanQualType>::const_iterator
          I = ArgTys.begin(), E = ArgTys.end(); I != E; ++I)
@@ -247,17 +243,8 @@
   // various situations, pass it in.
   llvm::SmallVector<const llvm::Type *, 8> PreferredArgTypes;
   for (llvm::SmallVectorImpl<CanQualType>::const_iterator
-       I = ArgTys.begin(), E = ArgTys.end(); I != E; ++I) {
-    // If this is being called from the guts of the ConvertType loop, make sure
-    // to call ConvertTypeRecursive so we don't get into issues with cyclic
-    // pointer type structures.
-    const llvm::Type *ArgType;
-    if (IsRecursive)
-      ArgType = ConvertTypeRecursive(*I);
-    else 
-      ArgType = ConvertType(*I);
-    PreferredArgTypes.push_back(ArgType);
-  }
+       I = ArgTys.begin(), E = ArgTys.end(); I != E; ++I)
+    PreferredArgTypes.push_back(ConvertType(*I));
 
   // Compute ABI information.
   getABIInfo().computeInfo(*FI, getContext(), TheModule.getContext(),

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=107232&r1=107231&r2=107232&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Tue Jun 29 19:22:35 2010
@@ -46,7 +46,7 @@
 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 @@
     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<ConstantArrayType>(Ty);
@@ -300,11 +299,7 @@
   }
   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 @@
       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<FunctionProtoType>(&Ty)) {
-      FI = &getFunctionInfo(
-                   CanQual<FunctionProtoType>::CreateUnsafe(QualType(FPT, 0)),
-                            true /*Recursive*/);
-      isVariadic = FPT->isVariadic();
-    } else {
-      const FunctionNoProtoType *FNPT = cast<FunctionNoProtoType>(&Ty);
-      FI = &getFunctionInfo(
-                CanQual<FunctionNoProtoType>::CreateUnsafe(QualType(FNPT, 0)),
-                            true /*Recursive*/);
-      isVariadic = true;
-    }
-
-    return GetFunctionType(*FI, isVariadic);
+    if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(&Ty))
+      return GetFunctionType(getFunctionInfo(
+                CanQual<FunctionProtoType>::CreateUnsafe(QualType(FPT,0))),
+                             FPT->isVariadic());
+
+    const FunctionNoProtoType *FNPT = cast<FunctionNoProtoType>(&Ty);
+    return GetFunctionType(getFunctionInfo(
+                CanQual<FunctionNoProtoType>::CreateUnsafe(QualType(FNPT,0))),
+                           true);
   }
 
   case Type::ObjCObject:

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.h?rev=107232&r1=107231&r2=107232&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.h Tue Jun 29 19:22:35 2010
@@ -154,11 +154,8 @@
     return getFunctionInfo(Ty->getResultType(), Args,
                            Ty->getExtInfo());
   }
-
-  const CGFunctionInfo &getFunctionInfo(CanQual<FunctionProtoType> Ty,
-                                        bool IsRecursive = false);
-  const CGFunctionInfo &getFunctionInfo(CanQual<FunctionNoProtoType> Ty,
-                                        bool IsRecursive = false);
+  const CGFunctionInfo &getFunctionInfo(CanQual<FunctionProtoType> Ty);
+  const CGFunctionInfo &getFunctionInfo(CanQual<FunctionNoProtoType> Ty);
 
   // getFunctionInfo - Get the function info for a member function.
   const CGFunctionInfo &getFunctionInfo(const CXXRecordDecl *RD,
@@ -179,8 +176,7 @@
   /// \param ArgTys - must all actually be canonical as params
   const CGFunctionInfo &getFunctionInfo(CanQualType RetTy,
                                const llvm::SmallVectorImpl<CanQualType> &ArgTys,
-                                        const FunctionType::ExtInfo &Info,
-                                        bool IsRecursive = false);
+                                        const FunctionType::ExtInfo &Info);
 
   /// \brief Compute a new LLVM record layout object for the given record.
   CGRecordLayout *ComputeRecordLayout(const RecordDecl *D);

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=107232&r1=107231&r2=107232&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Tue Jun 29 19:22:35 2010
@@ -830,7 +830,8 @@
   return SSE;
 }
 
-void X86_64ABIInfo::classify(QualType Ty, uint64_t OffsetBase,
+void X86_64ABIInfo::classify(QualType Ty,
+                             uint64_t OffsetBase,
                              Class &Lo, Class &Hi) const {
   // FIXME: This code can be simplified by introducing a simple value class for
   // Class pairs with appropriate constructor methods for the various

Modified: cfe/trunk/test/CodeGen/decl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/decl.c?rev=107232&r1=107231&r2=107232&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/decl.c (original)
+++ cfe/trunk/test/CodeGen/decl.c Tue Jun 29 19:22:35 2010
@@ -89,16 +89,3 @@
 struct test8s { int f0; char f1; } test8g = {};
 
 
-// PR7519
-
-struct S {
-  void (*x) (struct S *);
-};
-
-extern struct S *global_dc;
-void cp_diagnostic_starter(struct S *);
-
-void init_error(void) {
-  global_dc->x = cp_diagnostic_starter;
-}
-





More information about the cfe-commits mailing list