]> granicus.if.org Git - clang/commitdiff
Let attribute((cdecl)) and company override -mrtd default calling convention.
authorRoman Divacky <rdivacky@freebsd.org>
Fri, 5 Aug 2011 16:37:22 +0000 (16:37 +0000)
committerRoman Divacky <rdivacky@freebsd.org>
Fri, 5 Aug 2011 16:37:22 +0000 (16:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136971 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ASTContext.h
lib/Sema/SemaType.cpp

index 4e5e7888b4154f77a281f84a6bb5e4512880c3af..0c6bc954a7e4b27de7b819d0d32e5ddd3516177a 100644 (file)
@@ -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;
   }
index 2f93642d2f10c7bbef52f98ac3ccbdb051b51abc..f429449acfb7f51df7fa8f5b28a24993f49455cf 100644 (file)
@@ -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)