[cfe-dev] Symbol names for constructors
Azat Khuzhin
a3at.mail at gmail.com
Wed Apr 8 04:46:55 PDT 2015
On Wed, Apr 08, 2015 at 12:21:23PM +0100, Tamas Berghammer wrote:
> I am compiling the following code with clang TOT (clang version 3.7.0
> (trunk 234376) (llvm/trunk 234392) Target: x86_64-unknown-linux-gnu Thread
> model: posix) with the following command:
>
> === source ===
> class myInt {
> public: myInt(int _x) : theValue(_x) {}
> private: int theValue;
> };
>
> int main() {
> myInt x{3};
> return 0;
> }
>
> === compile command ===
> ./bin/clang++ --std=c++11 ~/tmp/C12.cpp
>
> After compilation I see a symbol created for the constructor with name
> "_ZN5myIntC2Ei" what is the base object constructor but I don't have a
> symbol for "_ZN5myIntC1Ei" what would be the complete object constructor.
You need to demangle symbol, since C++ do name mangling to support
functions with identical names and different arguments for example.
You could use c++filt for this:
$ c++filt _ZN5myIntC2Ei
myInt::myInt(int)
> This issue cause us some problem in LLDB during expression evaluation so I
> am interested if it is a bug (and clang should generate both symbol as gcc
> do) or it is an intended behavior as an optimization. In either case I
> would appreciate if someone can give me an idea about what is the case when
> only one of the symbol is emitted so I can handle that case in LLDB
> properly.
What problem in lldb?
More information about the cfe-dev
mailing list