]> granicus.if.org Git - clang/commit
MS ABI: Update the thunk linkage computation
authorHans Wennborg <hans@hanshq.net>
Fri, 6 Jun 2014 20:04:01 +0000 (20:04 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 6 Jun 2014 20:04:01 +0000 (20:04 +0000)
commit6c87b4a75691215d3b0a16083d9499d0ed869f81
tree0670e3f392c34b0a422f3cd45a5ac8651d995938
parent90a108e0ebda1f9a61be251e693bf8b28d9b5dba
MS ABI: Update the thunk linkage computation

As suggested by Reid:

 - class has GVA_Internal linkage -> internal
 - thunk has return adjustment -> weak_odr, to handle evil corner case [1]
 - all other normal methods -> linkonce_odr

 1. Evil corner case:

  struct Incomplete;
  struct A { int a; virtual A *bar(); };
  struct B { int b; virtual B *foo(Incomplete); };
  struct C : A, B { int c; virtual C *foo(Incomplete); };
  C c;

Here, the thunk for C::foo() will be emitted when C::foo() is defined, which
might be in a different translation unit, so it needs to be weak_odr.

Differential Revision: http://reviews.llvm.org/D3992

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210368 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGCXXABI.h
lib/CodeGen/CGVTables.cpp
lib/CodeGen/ItaniumCXXABI.cpp
lib/CodeGen/MicrosoftCXXABI.cpp
test/CodeGenCXX/dllimport.cpp
test/CodeGenCXX/microsoft-abi-structors.cpp
test/CodeGenCXX/microsoft-abi-thunks.cpp
test/CodeGenCXX/microsoft-abi-virtual-inheritance-vtordisps.cpp
test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp