[Reland] "Do not apply calling conventions to MSVC entry points"
authorElizabeth Andrews <elizabeth.andrews@intel.com>
Thu, 18 Mar 2021 09:58:35 +0000 (02:58 -0700)
committerElizabeth Andrews <elizabeth.andrews@intel.com>
Thu, 18 Mar 2021 11:26:47 +0000 (04:26 -0700)
commitd8b8f544d9de30cd14584094596090d3f9992345
treec6817cfd90f9f2e6ec74fb97b4170243c82d5872
parent388fbefb4f2aec19da221ebbc3e091919f7520a9
[Reland] "Do not apply calling conventions to MSVC entry points"

This patch is a second attempt at fixing a link error for MSVC
entry points when calling conventions are specified using a flag.

Calling conventions specified using flags should not be applied to MSVC
entry points. The default calling convention is set in this case. The
default calling convention for MSVC entry points main and wmain is cdecl.
For WinMain, wWinMain and DllMain, the default calling convention is
stdcall on 32 bit Windows.

Explicitly specified calling conventions are applied to MSVC entry points.

For MinGW, the default calling convention for all MSVC entry points is
cdecl.

First attempt: 4cff1b40dacf6
Revert of first attempt: bebfc3b92d5e8

Differential Revision: https://reviews.llvm.org/D97941
clang/lib/Sema/SemaDecl.cpp
clang/test/CodeGenCXX/default_calling_conv.cpp