Francois Pichet | 913b7bf | 2010-12-20 03:51:03 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-missing-declarations -x objective-c++ %s |
Steve Naroff | 239f073 | 2008-12-25 14:16:32 +0000 | [diff] [blame] | 2 | __stdcall int func0(); |
| 3 | int __stdcall func(); |
| 4 | typedef int (__cdecl *tptr)(); |
| 5 | void (*__fastcall fastpfunc)(); |
John McCall | b1d397c | 2010-08-05 17:13:11 +0000 | [diff] [blame] | 6 | struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {}; |
Steve Naroff | 239f073 | 2008-12-25 14:16:32 +0000 | [diff] [blame] | 7 | extern __declspec(dllimport) void __stdcall VarR4FromDec(); |
| 8 | __declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix); |
| 9 | __declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory ); |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 10 | typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR; |
| 11 | void * __ptr64 PtrToPtr64(const void *p) |
| 12 | { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 13 | return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p ); |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 14 | } |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 15 | void __forceinline InterlockedBitTestAndSet (long *Base, long Bit) |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 16 | { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 17 | __asm { |
| 18 | mov eax, Bit |
| 19 | mov ecx, Base |
| 20 | lock bts [ecx], eax |
| 21 | setc al |
| 22 | }; |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 23 | } |
Francois Pichet | 229ca4a | 2010-10-06 13:02:48 +0000 | [diff] [blame] | 24 | _inline int foo99() { return 99; } |
Steve Naroff | 86bc6cf | 2008-12-25 14:41:26 +0000 | [diff] [blame] | 25 | |
Steve Naroff | 47f5209 | 2009-01-06 19:34:12 +0000 | [diff] [blame] | 26 | void *_alloca(int); |
| 27 | |
| 28 | void foo() { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame] | 29 | __declspec(align(16)) int *buffer = (int *)_alloca(9); |
Steve Naroff | 47f5209 | 2009-01-06 19:34:12 +0000 | [diff] [blame] | 30 | } |
Douglas Gregor | 5a2f5d3 | 2009-01-10 00:48:18 +0000 | [diff] [blame] | 31 | |
| 32 | typedef bool (__stdcall __stdcall *blarg)(int); |
Chris Lattner | 6633522 | 2009-12-23 19:15:27 +0000 | [diff] [blame] | 33 | |
Chris Lattner | 6229c8e | 2010-09-28 23:35:09 +0000 | [diff] [blame] | 34 | void local_callconv() |
| 35 | { |
| 36 | bool (__stdcall *p)(int); |
| 37 | } |
Chris Lattner | 6633522 | 2009-12-23 19:15:27 +0000 | [diff] [blame] | 38 | |
| 39 | // Charify extension. |
| 40 | #define FOO(x) #@x |
| 41 | char x = FOO(a); |
| 42 | |
Douglas Gregor | 0c99ec6 | 2010-07-16 15:18:19 +0000 | [diff] [blame] | 43 | typedef enum E { e1 }; |
Francois Pichet | 01b7c30 | 2010-09-08 12:20:18 +0000 | [diff] [blame] | 44 | |
| 45 | |
Chandler Carruth | 81542fd | 2011-04-25 07:09:43 +0000 | [diff] [blame] | 46 | |
Francois Pichet | d3d3be9 | 2010-12-20 01:41:49 +0000 | [diff] [blame] | 47 | |
| 48 | |
Francois Pichet | b241946 | 2010-10-11 12:00:10 +0000 | [diff] [blame] | 49 | |
Francois Pichet | 334d47e | 2010-10-11 12:59:39 +0000 | [diff] [blame] | 50 | /* Microsoft attribute tests */ |
| 51 | [repeatable][source_annotation_attribute( Parameter|ReturnValue )] |
| 52 | struct SA_Post{ SA_Post(); int attr; }; |
| 53 | |
| 54 | [returnvalue:SA_Post( attr=1)] |
| 55 | int foo1([SA_Post(attr=1)] void *param); |
| 56 | |
| 57 | |
Francois Pichet | b241946 | 2010-10-11 12:00:10 +0000 | [diff] [blame] | 58 | |
| 59 | void ms_intrinsics(int a) |
| 60 | { |
| 61 | __noop(); |
| 62 | __assume(a); |
Francois Pichet | 699f9b1 | 2011-07-10 14:15:07 +0000 | [diff] [blame^] | 63 | __debugbreak(); |
Francois Pichet | b241946 | 2010-10-11 12:00:10 +0000 | [diff] [blame] | 64 | } |