<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 22, 2013 at 4:42 AM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: timurrrr<br>
Date: Fri Feb 22 06:42:50 2013<br>
New Revision: 175890<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=175890&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=175890&view=rev</a><br>
Log:<br>
Fix MergeFunctionDecl implicit CC for static methods.<br>
<br>
Patch by Alexander Zinenko!<br>
<br>
<br>
Added:<br>
    cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp   (with props)<br>
Modified:<br>
    cfe/trunk/lib/Sema/SemaDecl.cpp<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=175890&r1=175889&r2=175890&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=175890&r1=175889&r2=175890&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Feb 22 06:42:50 2013<br>
@@ -2328,9 +2328,10 @@ bool Sema::MergeFunctionDecl(FunctionDec<br>
     RequiresAdjustment = true;<br>
<br>
   // Don't complain about mismatches when the default CC is<br>
-  // effectively the same as the explict one.<br>
+  // effectively the same as the explict one. Only Old decl contains correct<br>
+  // information about storage class of CXXMethod.<br>
   } else if (OldTypeInfo.getCC() == CC_Default &&<br>
-             isABIDefaultCC(*this, NewTypeInfo.getCC(), New)) {<br>
+             isABIDefaultCC(*this, NewTypeInfo.getCC(), Old)) {<br>
     NewTypeInfo = NewTypeInfo.withCallingConv(OldTypeInfo.getCC());<br>
     RequiresAdjustment = true;<br>
<br>
<br>
Added: cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp?rev=175890&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp?rev=175890&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp (added)<br>
+++ cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp Fri Feb 22 06:42:50 2013<br>
@@ -0,0 +1,86 @@<br>
+// RUN: %clang_cc1 -triple i686-pc-win32 -cxx-abi microsoft -fms-extensions -verify %s<br>
+<br>
+// Pointers to free functions<br>
+void            free_func_default();<br>
+void __cdecl    free_func_cdecl();<br>
+void __stdcall  free_func_stdcall(); // expected-note {{previous declaration is here}}<br>
+void __fastcall free_func_fastcall(); // expected-note 2 {{previous declaration is here}}<br>
+<br>
+void __cdecl    free_func_default(); // expected-note 2 {{previous declaration is here}}<br>
+void __stdcall  free_func_default(); // expected-error {{function declared 'stdcall' here was previously declared without calling convention}}<br>
+void __fastcall free_func_default(); // expected-error {{function declared 'fastcall' here was previously declared without calling convention}}<br>
+<br>
+void            free_func_cdecl(); // expected-note 2 {{previous declaration is here}}<br>
+void __stdcall  free_func_cdecl(); // expected-error {{function declared 'stdcall' here was previously declared 'cdecl'}}<br>
+void __fastcall free_func_cdecl(); // expected-error {{function declared 'fastcall' here was previously declared 'cdecl'}}<br>
+<br>
+void __cdecl    free_func_stdcall(); // expected-error {{function declared 'cdecl' here was previously declared 'stdcall'}}<br>
+void            free_func_stdcall(); // expected-note {{previous declaration is here}}<br>
+void __fastcall free_func_stdcall(); // expected-error {{function declared 'fastcall' here was previously declared 'stdcall'}}<br>
+<br>
+void __cdecl    free_func_fastcall(); // expected-error {{function declared 'cdecl' here was previously declared 'fastcall'}}<br>
+void __stdcall  free_func_fastcall(); // expected-error {{function declared 'stdcall' here was previously declared 'fastcall'}}<br>
+void            free_func_fastcall();<br>
+<br>
+// Overloaded functions may have different calling conventions<br>
+void __fastcall free_func_default(int);<br>
+void __cdecl    free_func_default(int *);<br>
+<br>
+void __thiscall free_func_cdecl(char *);<br>
+void __cdecl    free_func_cdecl(double);<br>
+<br>
+<br>
+// Pointers to member functions<br>
+struct S {<br>
+  void            member_default1(); // expected-note {{previous declaration is here}}<br>
+  void            member_default2();<br>
+  void __cdecl    member_cdecl1();<br>
+  void __cdecl    member_cdecl2(); // expected-note {{previous declaration is here}}<br>
+  void __thiscall member_thiscall1();<br>
+  void __thiscall member_thiscall2(); // expected-note {{previous declaration is here}}<br>
+<br>
+  // Static member functions can't be __thiscall<br>
+  static void            static_member_default1();<br>
+  static void            static_member_default2(); // expected-note {{previous declaration is here}}<br>
+  static void __cdecl    static_member_cdecl1();<br>
+  static void __cdecl    static_member_cdecl2(); // expected-note {{previous declaration is here}}<br>
+  static void __stdcall  static_member_stdcall1();<br>
+  static void __stdcall  static_member_stdcall2();<br>
+<br>
+  // Variadic functions can't be other than default or __cdecl<br>
+  void            member_variadic_default(int x, ...);<br>
+  void __cdecl    member_variadic_cdecl(int x, ...);<br>
+<br>
+  static void            static_member_variadic_default(int x, ...);<br>
+  static void __cdecl    static_member_variadic_cdecl(int x, ...);<br>
+};<br>
+<br>
+void __cdecl    S::member_default1() {} // expected-error {{function declared 'cdecl' here was previously declared without calling convention}}<br>
+void __thiscall S::member_default2() {}<br>
+<br>
+void            S::member_cdecl1() {}<br>
+void __thiscall S::member_cdecl2() {} // expected-error {{function declared 'thiscall' here was previously declared 'cdecl'}}<br>
+<br>
+void            S::member_thiscall1() {}<br>
+void __cdecl    S::member_thiscall2() {} // expected-error {{function declared 'cdecl' here was previously declared 'thiscall'}}<br>
+<br>
+void __cdecl    S::static_member_default1() {}<br>
+void __stdcall  S::static_member_default2() {} // expected-error {{function declared 'stdcall' here was previously declared without calling convention}}<br>
+<br>
+void            S::static_member_cdecl1() {}<br>
+void __stdcall  S::static_member_cdecl2() {} // expected-error {{function declared 'stdcall' here was previously declared 'cdecl'}}<br>
+<br>
+void __cdecl    S::member_variadic_default(int x, ...) {<br>
+  (void)x;<br>
+}<br>
+void            S::member_variadic_cdecl(int x, ...) {<br>
+  (void)x;<br>
+}<br>
+<br>
+void __cdecl    S::static_member_variadic_default(int x, ...) {<br>
+  (void)x;<br>
+}<br>
+void            S::static_member_variadic_cdecl(int x, ...) {<br>
+  (void)x;<br>
+}<br>
+<br>
<br>
Propchange: cfe/trunk/test/SemaCXX/decl-microsoft-call-conv.cpp<br>
------------------------------------------------------------------------------<br>
    svn:eol-style = LF</blockquote><div><br></div><div style>Might want to check what's causing this in your svn client - we'd usually just leave the property unspecified I think. </div></div></div></div>