2010-09-08 20:20:18 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-unused-value -Wno-missing-declarations -x objective-c++ %s
|
2008-12-25 22:16:32 +08:00
|
|
|
__stdcall int func0();
|
|
|
|
int __stdcall func();
|
|
|
|
typedef int (__cdecl *tptr)();
|
|
|
|
void (*__fastcall fastpfunc)();
|
2010-08-06 01:13:11 +08:00
|
|
|
struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {};
|
2008-12-25 22:16:32 +08:00
|
|
|
extern __declspec(dllimport) void __stdcall VarR4FromDec();
|
|
|
|
__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix);
|
|
|
|
__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory );
|
2008-12-25 22:41:26 +08:00
|
|
|
typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR;
|
|
|
|
void * __ptr64 PtrToPtr64(const void *p)
|
|
|
|
{
|
2009-09-09 23:08:12 +08:00
|
|
|
return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p );
|
2008-12-25 22:41:26 +08:00
|
|
|
}
|
2009-07-22 08:43:08 +08:00
|
|
|
void __forceinline InterlockedBitTestAndSet (long *Base, long Bit)
|
2008-12-25 22:41:26 +08:00
|
|
|
{
|
2009-09-09 23:08:12 +08:00
|
|
|
__asm {
|
|
|
|
mov eax, Bit
|
|
|
|
mov ecx, Base
|
|
|
|
lock bts [ecx], eax
|
|
|
|
setc al
|
|
|
|
};
|
2008-12-25 22:41:26 +08:00
|
|
|
}
|
2010-10-06 21:02:48 +08:00
|
|
|
_inline int foo99() { return 99; }
|
2008-12-25 22:41:26 +08:00
|
|
|
|
2009-01-07 03:34:12 +08:00
|
|
|
void *_alloca(int);
|
|
|
|
|
|
|
|
void foo() {
|
2009-09-09 23:08:12 +08:00
|
|
|
__declspec(align(16)) int *buffer = (int *)_alloca(9);
|
2009-01-07 03:34:12 +08:00
|
|
|
}
|
2009-01-10 08:48:18 +08:00
|
|
|
|
|
|
|
typedef bool (__stdcall __stdcall *blarg)(int);
|
2009-12-24 03:15:27 +08:00
|
|
|
|
2010-09-29 07:35:09 +08:00
|
|
|
void local_callconv()
|
|
|
|
{
|
|
|
|
bool (__stdcall *p)(int);
|
|
|
|
}
|
2009-12-24 03:15:27 +08:00
|
|
|
|
|
|
|
// Charify extension.
|
|
|
|
#define FOO(x) #@x
|
|
|
|
char x = FOO(a);
|
|
|
|
|
2010-07-16 23:18:19 +08:00
|
|
|
typedef enum E { e1 };
|
2010-09-08 20:20:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
void uuidof_test1()
|
|
|
|
{
|
|
|
|
__uuidof(0); // expected-error {{you need to include <guiddef.h> before using the '__uuidof' operator}}
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct _GUID
|
|
|
|
{
|
|
|
|
unsigned long Data1;
|
|
|
|
unsigned short Data2;
|
|
|
|
unsigned short Data3;
|
|
|
|
unsigned char Data4[8];
|
|
|
|
} GUID;
|
|
|
|
struct __declspec(uuid("00000000-0000-0000-3231-000000000046")) A { };
|
|
|
|
struct __declspec(uuid("00000000-0000-0000-1234-000000000047")) B { };
|
|
|
|
class C {};
|
|
|
|
|
|
|
|
void uuidof_test2()
|
|
|
|
{
|
|
|
|
A* a = new A;
|
|
|
|
B b;
|
|
|
|
__uuidof(A);
|
|
|
|
__uuidof(*a);
|
|
|
|
__uuidof(B);
|
|
|
|
__uuidof(&b);
|
|
|
|
_uuidof(0);
|
|
|
|
|
|
|
|
// FIXME, this must not compile
|
|
|
|
_uuidof(1);
|
|
|
|
// FIXME, this must not compile
|
|
|
|
_uuidof(C);
|
|
|
|
|
|
|
|
C c;
|
|
|
|
// FIXME, this must not compile
|
|
|
|
_uuidof(c);
|
2010-12-17 10:00:06 +08:00
|
|
|
|
|
|
|
&_uuidof(0);
|
2010-09-08 20:20:18 +08:00
|
|
|
}
|
2010-10-11 20:00:10 +08:00
|
|
|
|
2010-10-11 20:59:39 +08:00
|
|
|
/* Microsoft attribute tests */
|
|
|
|
[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
|
|
|
|
struct SA_Post{ SA_Post(); int attr; };
|
|
|
|
|
|
|
|
[returnvalue:SA_Post( attr=1)]
|
|
|
|
int foo1([SA_Post(attr=1)] void *param);
|
|
|
|
|
|
|
|
|
2010-10-11 20:00:10 +08:00
|
|
|
|
|
|
|
void ms_intrinsics(int a)
|
|
|
|
{
|
|
|
|
__noop();
|
|
|
|
__assume(a);
|
|
|
|
|
|
|
|
}
|