convert c++ to c: using FAQ

Howdy all:

I’m on OS-X snow leopard, and am using XCode 4.2I’m following the FAQ to try converting c++ to c

llvm-g++ -emit-llvm -c temp.cpp -o temp.bc
llc -march=c temp.bc -o temp.c

I’m getting the following error:
llc: temp.bc: Invalid ALLOCA record

Anyone knows what I should do to correct it ?


Your llvm-gcc is based on an ancient version of LLVM that's incompatible with LLVM 3.0.
You can use clang instead. Also note that the C backend is probably not what you want, as
it doesn't support enough of LLVM IR to compile a non-trivial C++ program to C.

- Ben