diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 3555ccd53a593c748a26b17d4fe37756ee7a5765..c4877a6745337a53822e5b0321c4ce767f218caf 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()) - F->setCallingConv(llvm::CallingConv::Fast); + F->setCallingConv(llvm::CallingConv::X86_FastCall); + + if (D->getAttr()) + 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 0000000000000000000000000000000000000000..a599405d2798938d7399ded016584ea3ca74fcb9 --- /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; +} +