Symbol names for constructors

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.

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.

Thanks,
Tamas

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?

We try to find a function based on the mangled symbol name and it fails as they do not match (looking for _ZN5myIntC1Ei while the executable contains _ZN5myIntC2Ei). We can do a search based on de-mangled name but if the executable will contain both _ZN5myIntC1Ei and _ZN5myIntC2Ei then we will find both of them as they de-mangle to the same name (myInt::myInt(int)) because the only difference between them is that one of them should be called when constructing an object of type myInt (_ZN5myIntC1Ei) and the other one should be called when constructing an object with base class of myInt (_ZN5myIntC2Ei).