a bug in Kaleidoscope code


with LLVM 3.1, i am trying to compile toy.cpp from

i got the following error:

$ clang++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit
native` -O3 -o toy
toy.cpp:4:10: fatal error: 'llvm/IRBuilder.h' file not found
#include "llvm/IRBuilder.h"

i fixed this by modifying the broken line to:

#include "llvm/Support/IRBuilder.h"

then i compiled again, but got another error:

$ clang++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit
native` -O3 -o toy
toy.cpp:1115:18: error: unknown type name 'DataLayout'
  OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));

this is due to the removal of DataLayout structure from 3.1.
how can i fix this bug?


I also have come across this problem, it seems that simply removing the related code of DataLayout would be fine, although I do not whether it could lead some other problems.

Hongxu Chen

If you are using LLVM 3.1, you will want to use the docs from LLVM
3.1. The docs at llvm.org/docs/ are generated from the bleeding-edge
SVN revision. There is actually a warning about this at the top of
llvm.org/docs which points to the place to get the docs for older
versions, although I don't blame you for missing it.

-- Sean Silva