summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/builtin-calling-conv.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2019-05-23 16:05:21 +0000
committerErich Keane <erich.keane@intel.com>2019-05-23 16:05:21 +0000
commit000228183bf17a0f64afccdda35867553c9b75f6 (patch)
tree8e8ea65aad6c020c506a8cc0423c58c64eada1c0 /clang/test/CodeGenCXX/builtin-calling-conv.cpp
parent6aebd8394a2bb9e514d0eaf8c8124b79974a2ba8 (diff)
downloadbcm5719-llvm-000228183bf17a0f64afccdda35867553c9b75f6.tar.gz
bcm5719-llvm-000228183bf17a0f64afccdda35867553c9b75f6.zip
Ensure builtins use the target default Calling Convention
r355317 changed builtins/allocation functions to use the default calling convention in order to support platforms that use non-cdecl calling conventions by default. However the default calling convention is overridable on Windows 32 bit implementations with some of the /G options. The intent is to permit the user to set the calling convention of normal functions, however it should NOT apply to builtins and C++ allocation functions. This patch ensures that the builtin/allocation functions always use the Target specific Calling Convention, ignoring the user overridden version of said default. llvm-svn: 361507
Diffstat (limited to 'clang/test/CodeGenCXX/builtin-calling-conv.cpp')
-rw-r--r--clang/test/CodeGenCXX/builtin-calling-conv.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/builtin-calling-conv.cpp b/clang/test/CodeGenCXX/builtin-calling-conv.cpp
index 6fdeca0d2c4..f7759e3e8ca 100644
--- a/clang/test/CodeGenCXX/builtin-calling-conv.cpp
+++ b/clang/test/CodeGenCXX/builtin-calling-conv.cpp
@@ -2,6 +2,7 @@
// RUN: %clang_cc1 -triple spir-unknown-unknown -DREDECL -DSPIR -emit-llvm %s -o - | FileCheck %s -check-prefix SPIR
// RUN: %clang_cc1 -triple x86_64-linux-pc -emit-llvm %s -o - | FileCheck %s -check-prefix LINUX
// RUN: %clang_cc1 -triple spir-unknown-unknown -DSPIR -emit-llvm %s -o - | FileCheck %s -check-prefix SPIR
+// RUN: %clang_cc1 -triple i386-windows-pc -fdefault-calling-conv=stdcall -emit-llvm %s -o - | FileCheck %s -check-prefix WIN32
#ifdef REDECL
namespace std {
@@ -40,3 +41,13 @@ void user() {
// SPIR: declare spir_func noalias i8* @_Znwj(i32)
// SPIR: declare spir_func float @atan2f(float, float)
// SPIR: declare spir_func void @_Z3foov()
+
+// Note: Windows /G options should not change the platform default calling
+// convention of builtins.
+// WIN32: define dso_local x86_stdcallcc void @"?user@@YGXXZ"()
+// WIN32: call i8* @"??2@YAPAXI@Z"
+// WIN32: call float @atan2f
+// WIN32: call x86_stdcallcc void @"?foo@@YGXXZ"
+// WIN32: declare dso_local noalias i8* @"??2@YAPAXI@Z"(
+// WIN32: declare dso_local float @atan2f(float, float)
+// WIN32: declare dso_local x86_stdcallcc void @"?foo@@YGXXZ"()
OpenPOWER on IntegriCloud