Revert "Do not apply calling conventions to MSVC entry points"
This reverts commit 4cff1b40da
.
Caused "undefined symbol: _WinMain@16" link errors.
This commit is contained in:
parent
9a0d1b6673
commit
bebfc3b92d
|
@ -11095,11 +11095,6 @@ void Sema::CheckMSVCRTEntryPoint(FunctionDecl *FD) {
|
|||
if (FD->getName() != "DllMain")
|
||||
FD->setHasImplicitReturnZero(true);
|
||||
|
||||
if (FT->getCallConv() != CC_C) {
|
||||
FT = Context.adjustFunctionType(FT, FT->getExtInfo().withCallingConv(CC_C));
|
||||
FD->setType(QualType(FT, 0));
|
||||
}
|
||||
|
||||
if (!FD->isInvalidDecl() && FD->getDescribedFunctionTemplate()) {
|
||||
Diag(FD->getLocation(), diag::err_mainlike_template_decl) << FD;
|
||||
FD->setInvalidDecl();
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fdefault-calling-conv=cdecl -emit-llvm -o - %s -DMAIN | FileCheck %s --check-prefix=CDECL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i786-unknown-linux-gnu -target-feature +sse4.2 -fdefault-calling-conv=fastcall -emit-llvm -o - %s -DMAIN | FileCheck %s --check-prefix=FASTCALL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i486-unknown-linux-gnu -fdefault-calling-conv=stdcall -emit-llvm -o - %s -DMAIN | FileCheck %s --check-prefix=STDCALL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i486-unknown-linux-gnu -mrtd -emit-llvm -o - %s -DMAIN | FileCheck %s --check-prefix=STDCALL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i986-unknown-linux-gnu -fdefault-calling-conv=vectorcall -emit-llvm -o - %s -DMAIN | FileCheck %s --check-prefix=VECTORCALL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i986-unknown-linux-gnu -fdefault-calling-conv=regcall -emit-llvm -o - %s -DMAIN | FileCheck %s --check-prefix=REGCALL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i386-pc-win32 -target-feature +sse4.2 -fdefault-calling-conv=fastcall -emit-llvm -o - %s -DWMAIN | FileCheck %s --check-prefix=WMAIN
|
||||
// RUN: %clang_cc1 -triple i386-pc-win32 -target-feature +sse4.2 -fdefault-calling-conv=fastcall -emit-llvm -o - %s -DWINMAIN | FileCheck %s --check-prefix=WINMAIN
|
||||
// RUN: %clang_cc1 -triple i386-pc-win32 -target-feature +sse4.2 -fdefault-calling-conv=fastcall -emit-llvm -o - %s -DWWINMAIN | FileCheck %s --check-prefix=WWINMAIN
|
||||
// RUN: %clang_cc1 -triple i386-pc-win32 -target-feature +sse4.2 -fdefault-calling-conv=fastcall -emit-llvm -o - %s -DDLLMAIN | FileCheck %s --check-prefix=DLLMAIN
|
||||
//
|
||||
// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fdefault-calling-conv=cdecl -emit-llvm -o - %s | FileCheck %s --check-prefix=CDECL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i786-unknown-linux-gnu -target-feature +sse4.2 -fdefault-calling-conv=fastcall -emit-llvm -o - %s | FileCheck %s --check-prefix=FASTCALL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i486-unknown-linux-gnu -fdefault-calling-conv=stdcall -emit-llvm -o - %s | FileCheck %s --check-prefix=STDCALL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i486-unknown-linux-gnu -mrtd -emit-llvm -o - %s | FileCheck %s --check-prefix=STDCALL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i986-unknown-linux-gnu -fdefault-calling-conv=vectorcall -emit-llvm -o - %s | FileCheck %s --check-prefix=VECTORCALL --check-prefix=ALL
|
||||
// RUN: %clang_cc1 -triple i986-unknown-linux-gnu -fdefault-calling-conv=regcall -emit-llvm -o - %s | FileCheck %s --check-prefix=REGCALL --check-prefix=ALL
|
||||
|
||||
// CDECL: define void @_Z5test1v
|
||||
// FASTCALL: define x86_fastcallcc void @_Z5test1v
|
||||
// STDCALL: define x86_stdcallcc void @_Z5test1v
|
||||
|
@ -50,37 +46,7 @@ void test() {
|
|||
a.test_member();
|
||||
}
|
||||
|
||||
#ifdef MAIN
|
||||
// ALL: define i32 @main
|
||||
int main() {
|
||||
return 1;
|
||||
}
|
||||
#endif // main
|
||||
|
||||
#ifdef WMAIN
|
||||
// WMAIN: define dso_local i32 @wmain
|
||||
int wmain() {
|
||||
return 1;
|
||||
}
|
||||
#endif // wmain
|
||||
|
||||
#ifdef WINMAIN
|
||||
// WINMAIN: define dso_local i32 @WinMain
|
||||
int WinMain() {
|
||||
return 1;
|
||||
}
|
||||
#endif // WinMain
|
||||
|
||||
#ifdef WWINMAIN
|
||||
// WWINMAIN: define dso_local i32 @wWinMain
|
||||
int wWinMain() {
|
||||
return 1;
|
||||
}
|
||||
#endif // wWinMain
|
||||
|
||||
#ifdef DLLMAIN
|
||||
// DLLMAIN: define dso_local i32 @DllMain
|
||||
int DllMain() {
|
||||
return 1;
|
||||
}
|
||||
#endif // DllMain
|
||||
|
|
Loading…
Reference in New Issue