blob: 58f5879c30293786ea42d6fe2993ef7b4377dc44 [file] [log] [blame]
Francois Pichet01b7c302010-09-08 12:20:18 +00001// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-unused-value -Wno-missing-declarations -x objective-c++ %s
Steve Naroff239f0732008-12-25 14:16:32 +00002__stdcall int func0();
3int __stdcall func();
4typedef int (__cdecl *tptr)();
5void (*__fastcall fastpfunc)();
John McCallb1d397c2010-08-05 17:13:11 +00006struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {};
Steve Naroff239f0732008-12-25 14:16:32 +00007extern __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 Naroff86bc6cf2008-12-25 14:41:26 +000010typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
11void * __ptr64 PtrToPtr64(const void *p)
12{
Mike Stump1eb44332009-09-09 15:08:12 +000013 return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p );
Steve Naroff86bc6cf2008-12-25 14:41:26 +000014}
Mike Stumpd1969d82009-07-22 00:43:08 +000015void __forceinline InterlockedBitTestAndSet (long *Base, long Bit)
Steve Naroff86bc6cf2008-12-25 14:41:26 +000016{
Mike Stump1eb44332009-09-09 15:08:12 +000017 __asm {
18 mov eax, Bit
19 mov ecx, Base
20 lock bts [ecx], eax
21 setc al
22 };
Steve Naroff86bc6cf2008-12-25 14:41:26 +000023}
Francois Pichet229ca4a2010-10-06 13:02:48 +000024_inline int foo99() { return 99; }
Steve Naroff86bc6cf2008-12-25 14:41:26 +000025
Steve Naroff47f52092009-01-06 19:34:12 +000026void *_alloca(int);
27
28void foo() {
Mike Stump1eb44332009-09-09 15:08:12 +000029 __declspec(align(16)) int *buffer = (int *)_alloca(9);
Steve Naroff47f52092009-01-06 19:34:12 +000030}
Douglas Gregor5a2f5d32009-01-10 00:48:18 +000031
32typedef bool (__stdcall __stdcall *blarg)(int);
Chris Lattner66335222009-12-23 19:15:27 +000033
Chris Lattner6229c8e2010-09-28 23:35:09 +000034void local_callconv()
35{
36 bool (__stdcall *p)(int);
37}
Chris Lattner66335222009-12-23 19:15:27 +000038
39// Charify extension.
40#define FOO(x) #@x
41char x = FOO(a);
42
Douglas Gregor0c99ec62010-07-16 15:18:19 +000043typedef enum E { e1 };
Francois Pichet01b7c302010-09-08 12:20:18 +000044
45
46void uuidof_test1()
47{
48 __uuidof(0); // expected-error {{you need to include <guiddef.h> before using the '__uuidof' operator}}
49}
50
51typedef struct _GUID
52{
53 unsigned long Data1;
54 unsigned short Data2;
55 unsigned short Data3;
56 unsigned char Data4[8];
57} GUID;
58struct __declspec(uuid("00000000-0000-0000-3231-000000000046")) A { };
59struct __declspec(uuid("00000000-0000-0000-1234-000000000047")) B { };
60class C {};
61
62void uuidof_test2()
63{
64 A* a = new A;
65 B b;
66 __uuidof(A);
67 __uuidof(*a);
68 __uuidof(B);
69 __uuidof(&b);
70 _uuidof(0);
71
72 // FIXME, this must not compile
73 _uuidof(1);
74 // FIXME, this must not compile
75 _uuidof(C);
76
77 C c;
78 // FIXME, this must not compile
79 _uuidof(c);
80}
Francois Pichetb2419462010-10-11 12:00:10 +000081
82
83void ms_intrinsics(int a)
84{
85 __noop();
86 __assume(a);
87
88}