Consider the following files
foo.h
class Foo
{
Foo();
Foo(int x);
void bar();
}
foo.cc
# include foo.h
Foo::Foo() {}
Foo::Foo(int x) {}
void Foo::bar() {}
When compiling these files in LLVM bit foo.bcas follows
clang++ -c -o foo.bc -emit-llvm foo.cc
the resulting LLVM bitcode foo.bccontains two characters for each constructor definition, but only one character for the function definition. Why is this?
I tested this on both versions of LLVM versions 3.4 and 4.0.1, and the behavior occurs in both versions. For reference, here is the conclusion
llvm-nm foo.bc
T _ZN3Foo3barEv
T _ZN3FooC1Ei
T _ZN3FooC1Ev
T _ZN3FooC2Ei
T _ZN3FooC2Ev
- Change -
Based on the milleniumbug comment below, there is more information about object constructors here:
source
share