From: Roman Divacky Date: Fri, 5 Aug 2011 16:37:22 +0000 (+0000) Subject: Let attribute((cdecl)) and company override -mrtd default calling convention. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8e68f1c8a2919ea83c2053731d6011074f1062e1;p=clang Let attribute((cdecl)) and company override -mrtd default calling convention. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136971 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 4e5e7888b4..0c6bc954a7 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -1256,7 +1256,7 @@ public: /// \brief Retrieves the canonical representation of the given /// calling convention. CallingConv getCanonicalCallConv(CallingConv CC) const { - if (CC == CC_C) + if (!LangOpts.MRTD && CC == CC_C) return CC_Default; return CC; } diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 2f93642d2f..f429449acf 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -3482,7 +3482,7 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, return true; } - if (CCOld != CC_Default) { + if (CCOld != (S.LangOpts.MRTD ? CC_X86StdCall : CC_Default)) { // Should we diagnose reapplications of the same convention? S.Diag(attr.getLoc(), diag::err_attributes_are_not_compatible) << FunctionType::getNameForCallConv(CC)