Fix fastcall mangling of dllimported symbols
authorNico Rieck <nico.rieck@gmail.com>
Tue, 14 Jan 2014 11:53:26 +0000 (11:53 +0000)
committerNico Rieck <nico.rieck@gmail.com>
Tue, 14 Jan 2014 11:53:26 +0000 (11:53 +0000)
commit1b1321f0805d74481af18c1bdefd6ed7ef2b60e6
tree0b3bb45fe7076f7ca661939a405b8c49c3a18631
parentd13b9da1b6575329cebcaadb31fcf8f200cbd2c6
Fix fastcall mangling of dllimported symbols

fastcall requires @ as global prefix instead of _ but getNameWithPrefix
wrongly assumes the OutName buffer is empty and replaces at index 0.
For imported functions this buffer is pre-filled with "__imp_" resulting
in broken "@_imp_foo@0" mangling.

Instead replace at the proper index. We also never have to prepend the
@-prefix because this fastcall mangling is only used on 32-bit Windows
targets which have _ has global prefix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199203 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/Mangler.cpp