[llvm-commits] [llvm-gcc-4.2] r134723 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Duncan Sands baldrick at free.fr
Sat Jul 23 06:34:25 PDT 2011


Hi Chris,

On 08/07/11 21:58, Chris Lattner wrote:
> Author: lattner
> Date: Fri Jul  8 14:58:16 2011
> New Revision: 134723
>
> URL: http://llvm.org/viewvc/llvm-project?rev=134723&view=rev
> Log:
> fix failure on llvm-gcc-x86_64-darwin10-cross-i686-linux buildbot,
> void and function types cannot be in a struct, so wrap them with a pointer.

testcase?

Ciao, Duncan.

>
>
> Modified:
>      llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
>
> Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=134723&r1=134722&r2=134723&view=diff
> ==============================================================================
> --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
> +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Jul  8 14:58:16 2011
> @@ -139,7 +139,11 @@
>
>     const StructType *STy = cast<StructType>(V->getType()->getElementType());
>
> -  LTypes.insert(LTypes.end(), STy->subtype_begin(), STy->subtype_end());
> +  for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i)
> +    if (const PointerType *PTy = dyn_cast<PointerType>(STy->getElementType(i)))
> +      LTypes.push_back(PTy->getElementType());
> +    else
> +      LTypes.push_back(Type::getVoidTy(Context));
>
>     // Now, llvm.pch.types value is not required so remove it from the symbol
>     // table.
> @@ -153,10 +157,18 @@
>     if (LTypes.empty())
>       return;
>
> -  const StructType *AggregateTy = StructType::get(Context, LTypes);
> +  // Convert the LTypes list to a list of pointers.
> +  std::vector<const Type*>  PTys;
> +  for (unsigned i = 0, e = LTypes.size(); i != e; ++i) {
> +    // Cannot form pointer to void.  Use i8 as a sentinel.
> +    if (LTypes[i]->isVoidTy())
> +      PTys.push_back(Type::getInt8Ty(Context));
> +    else
> +      PTys.push_back(LTypes[i]->getPointerTo());
> +  }
>
>     // Create variable to hold this string table.
> -  (void)new GlobalVariable(*TheModule, AggregateTy, true,
> +  (void)new GlobalVariable(*TheModule, StructType::get(Context, PTys), true,
>                              GlobalValue::ExternalLinkage,
>                              /*noinit*/0, "llvm.pch.types");
>   }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list