FYI: new files in your commit have CR LF line endings. I'm not sure what the policy is, but I'd assume that most source/test files have LF line endings.<br><br><div class="gmail_quote">On Tue, Oct 2, 2012 at 4:26 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: aaronballman<br>
Date: Tue Oct  2 09:26:08 2012<br>
New Revision: 165015<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=165015&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=165015&view=rev</a><br>
Log:<br>
Allowing individual targets to determine whether a given calling convention is allowed or ignored with warning. This allows for correct name mangling for x64 targets on Windows, which in turn allows for linking against the Win32 APIs.<br>

<br>
Fixes PR13782<br>
<br>
Added:<br>
    cfe/trunk/test/CodeGen/microsoft-call-conv-x64.c<br>
    cfe/trunk/test/Sema/MicrosoftCompatibility-x64.c<br>
    cfe/trunk/test/Sema/stdcall-fastcall-x64.c<br>
Modified:<br>
    cfe/trunk/include/clang/AST/Type.h<br>
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
    cfe/trunk/include/clang/Basic/Specifiers.h<br>
    cfe/trunk/include/clang/Basic/TargetInfo.h<br>
    cfe/trunk/lib/Basic/Targets.cpp<br>
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp<br>
    cfe/trunk/lib/Sema/SemaType.cpp<br>
    cfe/trunk/test/CodeGen/microsoft-call-conv.c<br>
    cfe/trunk/test/CodeGen/stdcall-fastcall.c<br>
    cfe/trunk/test/CodeGenCXX/mangle-ms.cpp<br>
    cfe/trunk/test/Sema/MicrosoftCompatibility.c<br>
    cfe/trunk/test/Sema/callingconv.c<br>
    cfe/trunk/test/Sema/stdcall-fastcall.c<br>
<br>
Modified: cfe/trunk/include/clang/AST/Type.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/include/clang/AST/Type.h (original)<br>
+++ cfe/trunk/include/clang/AST/Type.h Tue Oct  2 09:26:08 2012<br>
@@ -20,6 +20,7 @@<br>
 #include "clang/Basic/Linkage.h"<br>
 #include "clang/Basic/PartialDiagnostic.h"<br>
 #include "clang/Basic/Visibility.h"<br>
+#include "clang/Basic/Specifiers.h"<br>
 #include "clang/AST/NestedNameSpecifier.h"<br>
 #include "clang/AST/TemplateName.h"<br>
 #include "llvm/Support/type_traits.h"<br>
@@ -490,18 +491,6 @@<br>
   static const uint32_t AddressSpaceShift = 8;<br>
 };<br>
<br>
-/// CallingConv - Specifies the calling convention that a function uses.<br>
-enum CallingConv {<br>
-  CC_Default,<br>
-  CC_C,           // __attribute__((cdecl))<br>
-  CC_X86StdCall,  // __attribute__((stdcall))<br>
-  CC_X86FastCall, // __attribute__((fastcall))<br>
-  CC_X86ThisCall, // __attribute__((thiscall))<br>
-  CC_X86Pascal,   // __attribute__((pascal))<br>
-  CC_AAPCS,       // __attribute__((pcs("aapcs")))<br>
-  CC_AAPCS_VFP    // __attribute__((pcs("aapcs-vfp")))<br>
-};<br>
-<br>
 /// A std::pair-like structure for storing a qualified type split<br>
 /// into its local qualifiers and its locally-unqualified type.<br>
 struct SplitQualType {<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Oct  2 09:26:08 2012<br>
@@ -1799,6 +1799,8 @@<br>
 def err_cconv_change : Error<<br>
   "function declared '%0' here was previously declared "<br>
   "%select{'%2'|without calling convention}1">;<br>
+def warn_cconv_ignored : Warning<<br>
+  "calling convention %0 ignored for this target">, InGroup<IgnoredAttributes>;<br>
 def err_cconv_knr : Error<<br>
   "function with no prototype cannot use %0 calling convention">;<br>
 def err_cconv_varargs : Error<<br>
<br>
Modified: cfe/trunk/include/clang/Basic/Specifiers.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/include/clang/Basic/Specifiers.h (original)<br>
+++ cfe/trunk/include/clang/Basic/Specifiers.h Tue Oct  2 09:26:08 2012<br>
@@ -175,6 +175,19 @@<br>
     ICIS_CopyInit, ///< Copy initialization.<br>
     ICIS_ListInit  ///< Direct list-initialization.<br>
   };<br>
+<br>
+  /// \brief CallingConv - Specifies the calling convention that a function uses.<br>
+  enum CallingConv {<br>
+    CC_Default,<br>
+    CC_C,           // __attribute__((cdecl))<br>
+    CC_X86StdCall,  // __attribute__((stdcall))<br>
+    CC_X86FastCall, // __attribute__((fastcall))<br>
+    CC_X86ThisCall, // __attribute__((thiscall))<br>
+    CC_X86Pascal,   // __attribute__((pascal))<br>
+    CC_AAPCS,       // __attribute__((pcs("aapcs")))<br>
+    CC_AAPCS_VFP    // __attribute__((pcs("aapcs-vfp")))<br>
+  };<br>
+<br>
 } // end namespace clang<br>
<br>
 #endif // LLVM_CLANG_BASIC_SPECIFIERS_H<br>
<br>
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)<br>
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Oct  2 09:26:08 2012<br>
@@ -24,6 +24,7 @@<br>
 #include "llvm/Support/DataTypes.h"<br>
 #include "clang/Basic/AddressSpaces.h"<br>
 #include "clang/Basic/VersionTuple.h"<br>
+#include "clang/Basic/Specifiers.h"<br>
 #include <cassert><br>
 #include <vector><br>
 #include <string><br>
@@ -712,6 +713,34 @@<br>
<br>
   bool isBigEndian() const { return BigEndian; }<br>
<br>
+  /// \brief Gets the default calling convention for the given target and<br>
+  /// declaration context.<br>
+  virtual CallingConv getDefaultCallingConv() const {<br>
+    // Not all targets will specify an explicit calling convention that we can<br>
+    // express.  This will always do the right thing, even though it's not<br>
+    // an explicit calling convention.<br>
+    return CC_Default;<br>
+  }<br>
+<br>
+  enum CallingConvCheckResult {<br>
+    CCCR_OK,<br>
+    CCCR_Warning<br>
+  };<br>
+<br>
+  /// \brief Determines whether a given calling convention is valid for the<br>
+  /// target. A calling convention can either be accepted, produce a warning<br>
+  /// and be substituted with the default calling convention, or (someday)<br>
+  /// produce an error (such as using thiscall on a non-instance function).<br>
+  virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const {<br>
+    switch (CC) {<br>
+      default:<br>
+        return CCCR_Warning;<br>
+      case CC_C:<br>
+      case CC_Default:<br>
+        return CCCR_OK;<br>
+    }<br>
+  }<br>
+<br>
 protected:<br>
   virtual uint64_t getPointerWidthV(unsigned AddrSpace) const {<br>
     return PointerWidth;<br>
<br>
Modified: cfe/trunk/lib/Basic/Targets.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Basic/Targets.cpp (original)<br>
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Oct  2 09:26:08 2012<br>
@@ -1673,6 +1673,19 @@<br>
     }<br>
     llvm_unreachable("Unhandled CPU kind");<br>
   }<br>
+<br>
+  virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const {<br>
+    // We accept all non-ARM calling conventions<br>
+    return (CC == CC_X86ThisCall ||<br>
+            CC == CC_X86FastCall ||<br>
+            CC == CC_X86StdCall ||<br>
+            CC == CC_C ||<br>
+            CC == CC_X86Pascal) ? CCCR_OK : CCCR_Warning;<br>
+  }<br>
+<br>
+  virtual CallingConv getDefaultCallingConv() const {<br>
+    return CC_C;<br>
+  }<br>
 };<br>
<br>
 void X86TargetInfo::getDefaultFeatures(llvm::StringMap<bool> &Features) const {<br>
@@ -2708,6 +2721,15 @@<br>
     if (RegNo == 1) return 1;<br>
     return -1;<br>
   }<br>
+<br>
+  virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const {<br>
+    return TargetInfo::checkCallingConvention(CC);<br>
+  }<br>
+<br>
+  virtual CallingConv getDefaultCallingConv() const {<br>
+    return CC_Default;<br>
+  }<br>
+<br>
 };<br>
 } // end anonymous namespace<br>
<br>
@@ -3167,6 +3189,10 @@<br>
     // FIXME: Is this really right?<br>
     return "";<br>
   }<br>
+<br>
+  virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const {<br>
+    return (CC == CC_AAPCS || CC == CC_AAPCS_VFP) ? CCCR_OK : CCCR_Warning;<br>
+  }<br>
 };<br>
<br>
 const char * const ARMTargetInfo::GCCRegNames[] = {<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Oct  2 09:26:08 2012<br>
@@ -3638,6 +3638,13 @@<br>
   default: llvm_unreachable("unexpected attribute kind");<br>
   }<br>
<br>
+  const TargetInfo &TI = Context.getTargetInfo();<br>
+  TargetInfo::CallingConvCheckResult A = TI.checkCallingConvention(CC);<br>
+  if (A == TargetInfo::CCCR_Warning) {<br>
+    Diag(attr.getLoc(), diag::warn_cconv_ignored) << attr.getName();<br>
+    CC = TI.getDefaultCallingConv();<br>
+  }<br>
+<br>
   return false;<br>
 }<br>
<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaType.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaType.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaType.cpp Tue Oct  2 09:26:08 2012<br>
@@ -3886,14 +3886,14 @@<br>
     return true;<br>
   }<br>
<br>
+  // Delay if the type didn't work out to a function.<br>
+  if (!unwrapped.isFunctionType()) return false;<br>
+<br>
   // Otherwise, a calling convention.<br>
   CallingConv CC;<br>
   if (S.CheckCallingConvAttr(attr, CC))<br>
     return true;<br>
<br>
-  // Delay if the type didn't work out to a function.<br>
-  if (!unwrapped.isFunctionType()) return false;<br>
-<br>
   const FunctionType *fn = unwrapped.get();<br>
   CallingConv CCOld = fn->getCallConv();<br>
   if (S.Context.getCanonicalCallConv(CC) ==<br>
<br>
Added: cfe/trunk/test/CodeGen/microsoft-call-conv-x64.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/microsoft-call-conv-x64.c?rev=165015&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/microsoft-call-conv-x64.c?rev=165015&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/CodeGen/microsoft-call-conv-x64.c (added)<br>
+++ cfe/trunk/test/CodeGen/microsoft-call-conv-x64.c Tue Oct  2 09:26:08 2012<br>
@@ -0,0 +1,39 @@<br>
+// RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm < %s | FileCheck %s<br>
+<br>
+void __fastcall f1(void);<br>
+void __stdcall f2(void);<br>
+void __fastcall f4(void) {<br>
+// CHECK: define void @f4()<br>
+  f1();<br>
+// CHECK: call void @f1()<br>
+}<br>
+void __stdcall f5(void) {<br>
+// CHECK: define void @f5()<br>
+  f2();<br>
+// CHECK: call void @f2()<br>
+}<br>
+<br>
+// PR5280<br>
+void (__fastcall *pf1)(void) = f1;<br>
+void (__stdcall *pf2)(void) = f2;<br>
+void (__fastcall *pf4)(void) = f4;<br>
+void (__stdcall *pf5)(void) = f5;<br>
+<br>
+int main(void) {<br>
+    f4(); f5();<br>
+    // CHECK: call void @f4()<br>
+    // CHECK: call void @f5()<br>
+    pf1(); pf2(); pf4(); pf5();<br>
+    // CHECK: call void %{{.*}}()<br>
+    // CHECK: call void %{{.*}}()<br>
+    // CHECK: call void %{{.*}}()<br>
+    // CHECK: call void %{{.*}}()<br>
+    return 0;<br>
+}<br>
+<br>
+// PR7117<br>
+void __stdcall f7(foo) int foo; {}<br>
+void f8(void) {<br>
+  f7(0);<br>
+  // CHECK: call void @f7(i32 0)<br>
+}<br>
<br>
Modified: cfe/trunk/test/CodeGen/microsoft-call-conv.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/microsoft-call-conv.c?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/microsoft-call-conv.c?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/CodeGen/microsoft-call-conv.c (original)<br>
+++ cfe/trunk/test/CodeGen/microsoft-call-conv.c Tue Oct  2 09:26:08 2012<br>
@@ -1,4 +1,4 @@<br>
-// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s<br>
+// RUN: %clang_cc1 -triple i386-pc-linux -emit-llvm < %s | FileCheck %s<br>
<br>
 void __fastcall f1(void);<br>
 void __stdcall f2(void);<br>
<br>
Modified: cfe/trunk/test/CodeGen/stdcall-fastcall.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/stdcall-fastcall.c?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/stdcall-fastcall.c?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/CodeGen/stdcall-fastcall.c (original)<br>
+++ cfe/trunk/test/CodeGen/stdcall-fastcall.c Tue Oct  2 09:26:08 2012<br>
@@ -1,4 +1,4 @@<br>
-// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s<br>
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm < %s | FileCheck %s<br>
<br>
 void __attribute__((fastcall)) f1(void);<br>
 void __attribute__((stdcall)) f2(void);<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/mangle-ms.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms.cpp?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms.cpp?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/mangle-ms.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/mangle-ms.cpp Tue Oct  2 09:26:08 2012<br>
@@ -1,4 +1,5 @@<br>
 // RUN: %clang_cc1 -fms-extensions -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s<br>
+// RUN: %clang_cc1 -fms-compatibility -fblocks -emit-llvm %s -o - -cxx-abi microsoft -triple=x86_64-pc-win32 | FileCheck -check-prefix X64 %s<br>
<br>
 // CHECK: @"\01?a@@3HA"<br>
 // CHECK: @"\01?b@N@@3HA"<br>
@@ -109,6 +110,7 @@<br>
 }<br>
<br>
 // CHECK: @"\01?alpha@@YGXMN@Z"<br>
+// X64: @"\01?alpha@@YAXMN@Z"<br>
<br>
 // Make sure tag-type mangling works.<br>
 void gamma(class foo, struct bar, union baz, enum quux) {}<br>
<br>
Added: cfe/trunk/test/Sema/MicrosoftCompatibility-x64.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftCompatibility-x64.c?rev=165015&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftCompatibility-x64.c?rev=165015&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/Sema/MicrosoftCompatibility-x64.c (added)<br>
+++ cfe/trunk/test/Sema/MicrosoftCompatibility-x64.c Tue Oct  2 09:26:08 2012<br>
@@ -0,0 +1,8 @@<br>
+// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-compatibility -triple x86_64-pc-win32<br>
+int __stdcall f(void); /* expected-warning {{calling convention '__stdcall' ignored for this target}} */<br>
+<br>
+/* This should compile without warning because __stdcall is treated<br>
+as __cdecl in MS compatibility mode for x64 compiles*/<br>
+int __cdecl f(void) {<br>
+  return 0;<br>
+}<br>
<br>
Modified: cfe/trunk/test/Sema/MicrosoftCompatibility.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftCompatibility.c?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftCompatibility.c?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/Sema/MicrosoftCompatibility.c (original)<br>
+++ cfe/trunk/test/Sema/MicrosoftCompatibility.c Tue Oct  2 09:26:08 2012<br>
@@ -18,4 +18,10 @@<br>
 __declspec(align(32768)) struct S1 { int a; } s;       /* expected-error {{requested alignment must be 8192 bytes or smaller}} */<br>
 struct __declspec(aligned) S2 {}; /* expected-warning {{unknown __declspec attribute 'aligned' ignored}} */<br>
<br>
-struct __declspec(appdomain) S3 {}; /* expected-warning {{__declspec attribute 'appdomain' is not supported}} */<br>
\ No newline at end of file<br>
+struct __declspec(appdomain) S3 {}; /* expected-warning {{__declspec attribute 'appdomain' is not supported}} */<br>
+<br>
+int __stdcall f(void); /* expected-note {{previous declaration is here}} */<br>
+<br>
+int __cdecl f(void) { /* expected-error {{function declared 'cdecl' here was previously declared 'stdcall'}} */<br>
+  return 0;<br>
+}<br>
<br>
Modified: cfe/trunk/test/Sema/callingconv.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/callingconv.c?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/callingconv.c?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/Sema/callingconv.c (original)<br>
+++ cfe/trunk/test/Sema/callingconv.c Tue Oct  2 09:26:08 2012<br>
@@ -1,4 +1,4 @@<br>
-// RUN: %clang_cc1 %s -fsyntax-only -verify<br>
+// RUN: %clang_cc1 %s -fsyntax-only -triple i386-unknown-unknown -verify<br>
<br>
 void __attribute__((fastcall)) foo(float *a) {<br>
 }<br>
@@ -40,8 +40,9 @@<br>
 int __attribute__((pcs())) pcs2(void); // expected-error {{attribute takes one argument}}<br>
 int __attribute__((pcs(pcs1))) pcs3(void); // expected-error {{attribute takes one argument}}<br>
 int __attribute__((pcs(0))) pcs4(void); // expected-error {{'pcs' attribute requires parameter 1 to be a string}}<br>
-int __attribute__((pcs("aapcs"))) pcs5(void); // no-error<br>
-int __attribute__((pcs("aapcs-vfp"))) pcs6(void); // no-error<br>
+/* These are ignored because the target is i386 and not ARM */<br>
+int __attribute__((pcs("aapcs"))) pcs5(void); // expected-warning {{calling convention 'pcs' ignored for this target}}<br>
+int __attribute__((pcs("aapcs-vfp"))) pcs6(void); // expected-warning {{calling convention 'pcs' ignored for this target}}<br>
 int __attribute__((pcs("foo"))) pcs7(void); // expected-error {{Invalid PCS type}}<br>
<br>
 // PR6361<br>
<br>
Added: cfe/trunk/test/Sema/stdcall-fastcall-x64.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/stdcall-fastcall-x64.c?rev=165015&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/stdcall-fastcall-x64.c?rev=165015&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/Sema/stdcall-fastcall-x64.c (added)<br>
+++ cfe/trunk/test/Sema/stdcall-fastcall-x64.c Tue Oct  2 09:26:08 2012<br>
@@ -0,0 +1,20 @@<br>
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-linux-gnu %s<br>
+<br>
+// CC qualifier can be applied only to functions<br>
+int __attribute__((stdcall)) var1; // expected-warning{{'stdcall' only applies to function types; type here is 'int'}}<br>
+int __attribute__((fastcall)) var2; // expected-warning{{'fastcall' only applies to function types; type here is 'int'}}<br>
+<br>
+// Different CC qualifiers are not compatible<br>
+void __attribute__((stdcall, fastcall)) foo3(void); // expected-warning{{calling convention 'stdcall' ignored for this target}} expected-warning {{calling convention 'fastcall' ignored for this target}}<br>

+void __attribute__((stdcall)) foo4(); // expected-warning{{calling convention 'stdcall' ignored for this target}}<br>
+void __attribute__((fastcall)) foo4(void); // expected-warning {{calling convention 'fastcall' ignored for this target}}<br>
+<br>
+// rdar://8876096<br>
+void rdar8876096foo1(int i, int j) __attribute__((fastcall, cdecl)); // expected-warning{{calling convention 'fastcall' ignored for this target}}<br>
+void rdar8876096foo2(int i, int j) __attribute__((fastcall, stdcall)); // expected-warning{{calling convention 'stdcall' ignored for this target}} expected-warning {{calling convention 'fastcall' ignored for this target}}<br>

+void rdar8876096foo3(int i, int j) __attribute__((fastcall, regparm(2))); // expected-warning {{calling convention 'fastcall' ignored for this target}}<br>
+void rdar8876096foo4(int i, int j) __attribute__((stdcall, cdecl)); // expected-warning{{calling convention 'stdcall' ignored for this target}}<br>
+void rdar8876096foo5(int i, int j) __attribute__((stdcall, fastcall)); // expected-warning{{calling convention 'stdcall' ignored for this target}} expected-warning {{calling convention 'fastcall' ignored for this target}}<br>

+void rdar8876096foo6(int i, int j) __attribute__((cdecl, fastcall)); // expected-warning {{calling convention 'fastcall' ignored for this target}}<br>
+void rdar8876096foo7(int i, int j) __attribute__((cdecl, stdcall)); // expected-warning{{calling convention 'stdcall' ignored for this target}}<br>
+void rdar8876096foo8(int i, int j) __attribute__((regparm(2), fastcall)); // expected-warning {{calling convention 'fastcall' ignored for this target}}<br>
<br>
Modified: cfe/trunk/test/Sema/stdcall-fastcall.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/stdcall-fastcall.c?rev=165015&r1=165014&r2=165015&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/stdcall-fastcall.c?rev=165015&r1=165014&r2=165015&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/Sema/stdcall-fastcall.c (original)<br>
+++ cfe/trunk/test/Sema/stdcall-fastcall.c Tue Oct  2 09:26:08 2012<br>
@@ -1,4 +1,3 @@<br>
-// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-pc-linux-gnu %s<br>
 // RUN: %clang_cc1 -fsyntax-only -verify -triple i686-apple-darwin10 %s<br>
<br>
 // CC qualifier can be applied only to functions<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div><font color="#666666"><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(213,15,37);border-right-color:rgb(213,15,37);border-bottom-color:rgb(213,15,37);border-left-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Alexander Kornienko |</span><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(51,105,232);border-right-color:rgb(51,105,232);border-bottom-color:rgb(51,105,232);border-left-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> Software Engineer |</span></font><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(0,153,57);border-right-color:rgb(0,153,57);border-bottom-color:rgb(0,153,57);border-left-color:rgb(0,153,57);padding-top:2px;margin-top:2px"><font color="#666666"> </font><a href="mailto:alexfh@google.com" style="color:rgb(17,85,204)" target="_blank">alexfh@google.com</a> |</span><span style="border-top-width:2px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(238,178,17);border-right-color:rgb(238,178,17);border-bottom-color:rgb(238,178,17);border-left-color:rgb(238,178,17);padding-top:2px;margin-top:2px"> <a value="+35315435283" style="color:rgb(17,85,204)">+49 151 221 77 957</a></span></div>
</div><div><font color="#666666"><span style="background-color:rgb(255,255,255);font-family:Arial,Verdana,sans-serif">Google Germany GmbH | </span><span style="background-color:rgb(255,255,255);font-family:Arial,Verdana,sans-serif">Dienerstr. 12 | </span><span style="background-color:rgb(255,255,255);font-family:Arial,Verdana,sans-serif">80331 München</span></font></div>
<br>