[LLVMdev] Module->getDataLayout returns std::string instead of DataLayout

Logan Streondj streondj at gmail.com
Mon Aug 25 03:50:47 PDT 2014


hey, 
so I'm writing in cpp.
the documentation says that TheModule -> getDataLayout should return
const DataLayout,  but instead it is returning std::string.

I require it to return DataLayout, as I generalize my function
pass manager to accept the DataLayout constant as an argument, it
being the only thing in common amongst both the ExecutionEngine and
the Module class.

Any pointers to how to get this to work?

here is error output:
$ clang++ -g -O3  src/spel.cpp `llvm-config --cppflags --ldflags --libs
core jit native` -o  bin/spel
src/spel.cpp:70:6: error: no matching function for call to 'fpmCreate'
fpmCreate(TheModule,TheModule->getDataLayout());
^~~~~~~~~
src/optimize.cpp:1:12: note: candidate function not viable: no known
conversion from 'const std::string' (aka 'const basic_string<char>')
to                          'const llvm::DataLayout' for 2nd argument
static int fpmCreate(Module *TheModule, const DataLayout dataLayout) {
^
1 error generated.     


here is relevant source lines:
optimize.cpp:1: 
static int fpmCreate(Module *TheModule, const DataLayout dataLayout) { 

spel.cpp:70:
fpmCreate(TheModule,TheModule->getDataLayout());

spel.cpp:45:
TheModule = new Module("my cool jit", Context);

can also view full sources at http://mkaw.tk/lang/hapli/cpp/spel/src/



More information about the llvm-dev mailing list