andreybokhanko added a comment.
John,
Thank you for the quick reply!
Let me make sure I understand what you said, using my test as an example (BTW,
sorry if this is a dumb question -- I asked our local Clang experts, but no-one
seems to be 100% sure what to do):
1: struct T {
2: ~T() {}
3: };
4:
5: extern "C" void _ZN1TD1Ev();
6:
7: int main() {
8: _ZN1TD1Ev();
9: T t;
10: }
When we deal with the call at line N8, there are no Functions created yet, so
nothing to bitcast. Thus, we create a Function and the following call:
call void @_ZN1TD1Ev()
When we deal with implicit destructor call at line N10, there is already a
Function with "_ZN1TD1Ev" mangled name exists. Thus, we create a bitcast and
the following call:
call void bitcast (void ()* @_ZN1TD1Ev to void (%struct.T*)*)(%struct.T* %t)
At the end of IRGen we should replace all references of old _ZN1TD1Ev (one with
zero arguments) with new _ZN1TD1Ev (one with a single T* argument) --
*including* adding a new bitcast (as we replace a Function with different type)
in all places in IR where we do the replacement.
Is my understanding correct?
Andrey
http://reviews.llvm.org/D11297
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits