• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 %s -fsyntax-only -verify -fborland-extensions
2 
3 // Borland extensions
4 
5 // 1. test  -fborland-extensions
dummy_function()6 int dummy_function() { return 0; }
7 
8 // 2. test __pascal
9 int _pascal f2();
10 
11 float __pascal gi2(int, int);
g2(T (__pascal * const)(int,int))12 template<typename T> T g2(T (__pascal * const )(int, int)) { return 0; }
13 
14 struct M {
15     int __pascal addP();
16     float __pascal subtractP();
17 };
h2(T (__pascal M::* const)())18 template<typename T> int h2(T (__pascal M::* const )()) { return 0; }
m2()19 void m2() {
20     int i; float f;
21     i = f2();
22     f = gi2(2, i);
23     f = g2(gi2);
24     i = h2<int>(&M::addP);
25     f = h2(&M::subtractP);
26 }
27 
28 // 3. test other calling conventions
29 int _cdecl fa3();
30 int _fastcall fc3();
31 int _stdcall fd3();
32 
33 // 4. test __uuidof()
34 typedef struct _GUID {
35      unsigned long  Data1;
36      unsigned short Data2;
37      unsigned short Data3;
38      unsigned char  Data4[ 8 ];
39 } GUID;
40 
41 struct __declspec(uuid("{12345678-1234-1234-1234-123456789abc}")) Foo;
42 struct Data {
43      GUID const* Guid;
44 };
45 
t4()46 void t4() {
47     unsigned long  data;
48 
49     const GUID guid_inl = __uuidof(Foo);
50     Data ata1 = { &guid_inl};
51     data = ata1.Guid->Data1;
52 }
53 
54