Module->getDataLayout returns std::string instead of DataLayout

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/

From: llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu]
On Behalf Of Logan Streondj
Subject: [LLVMdev] Module->getDataLayout returns std::string instead of DataLayout

the documentation says that TheModule -> getDataLayout should return
const DataLayout, but instead it is returning std::string.

No, it says it returns const DataLayout *.

optimize.cpp:1:
static int fpmCreate(Module *TheModule, const DataLayout dataLayout) {

Your declaration is missing the pointer indication.

- Chuck

From: Logan Streondj [mailto:streondj@gmail.com]
Subject: Re: [LLVMdev] Module->getDataLayout returns std::string instead of DataLayout

I tried it with the *, but it didn't help.

The online documentation applies _only_ to the LLVM trunk. You didn't tell us what level of LLVM you're trying to use, but the JavaDoc you should be looking at is part of whatever level you downloaded.

- Chuck

From: Caldarale, Charles R
Subject: RE: [LLVMdev] Module->getDataLayout returns std::string instead of DataLayout

The online documentation applies _only_ to the LLVM trunk. You didn't tell us what
level of LLVM you're trying to use, but the JavaDoc you should be looking at is part
of whatever level you downloaded.

Oops, wrong project; use "doxygen" for "JavaDoc" in the above.

- Chuck