[PATCH] D16628: clang-cl: support __cdecl-on-struct anachronism
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 21 09:13:57 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL263947: clang-cl: support __cdecl-on-struct anachronism (authored by rnk).
Changed prior to commit:
http://reviews.llvm.org/D16628?vs=46228&id=51176#toc
Repository:
rL LLVM
http://reviews.llvm.org/D16628
Files:
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/test/Parser/ms-anachronism.c
Index: cfe/trunk/test/Parser/ms-anachronism.c
===================================================================
--- cfe/trunk/test/Parser/ms-anachronism.c
+++ cfe/trunk/test/Parser/ms-anachronism.c
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -fsyntax-only -verify %s
+
+struct {} __cdecl s; // expected-warning {{'__cdecl' only applies to function types; type here is 'struct}}
Index: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
===================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp
@@ -1103,6 +1103,15 @@
return true;
case tok::colon:
return CouldBeBitfield; // enum E { ... } : 2;
+ // Microsoft compatibility
+ case tok::kw___cdecl: // struct foo {...} __cdecl x;
+ case tok::kw___fastcall: // struct foo {...} __fastcall x;
+ case tok::kw___stdcall: // struct foo {...} __stdcall x;
+ case tok::kw___thiscall: // struct foo {...} __thiscall x;
+ case tok::kw___vectorcall: // struct foo {...} __vectorcall x;
+ // We will diagnose these calling-convention specifiers on non-function
+ // declarations later, so claim they are valid after a type specifier.
+ return getLangOpts().MicrosoftExt;
// Type qualifiers
case tok::kw_const: // struct foo {...} const x;
case tok::kw_volatile: // struct foo {...} volatile x;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16628.51176.patch
Type: text/x-patch
Size: 1457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160321/ebbc471a/attachment.bin>
More information about the cfe-commits
mailing list