diff options
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 5 | ||||
-rw-r--r-- | clang/test/CodeGen/stdcall-fastcall.c | 17 |
2 files changed, 21 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 3555ccd53a5..c4877a67453 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -252,7 +252,10 @@ void CodeGenModule::SetFunctionAttributes(const Decl *D, // Set the appropriate calling convention for the Function. if (D->getAttr<FastCallAttr>()) - F->setCallingConv(llvm::CallingConv::Fast); + F->setCallingConv(llvm::CallingConv::X86_FastCall); + + if (D->getAttr<StdCallAttr>()) + F->setCallingConv(llvm::CallingConv::X86_StdCall); } /// SetFunctionAttributesForDefinition - Set function attributes diff --git a/clang/test/CodeGen/stdcall-fastcall.c b/clang/test/CodeGen/stdcall-fastcall.c new file mode 100644 index 00000000000..a599405d279 --- /dev/null +++ b/clang/test/CodeGen/stdcall-fastcall.c @@ -0,0 +1,17 @@ +// RUN: clang -emit-llvm < %s | grep 'fastcallcc' | count 4 +// RUN: clang -emit-llvm < %s | grep 'stdcallcc' | count 4 + +void __attribute__((fastcall)) f1(void); +void __attribute__((stdcall)) f2(void); +void __attribute__((fastcall)) f3(void) { + f1(); +} +void __attribute__((stdcall)) f4(void) { + f2(); +} + +int main(void) { + f3(); f4(); + return 0; +} + |