[cfe-commits] r138134 - in /cfe/trunk/test/CodeGenCXX: 2007-01-06-PtrMethodInit.cpp 2007-04-05-PackedBitFields-1.cpp 2007-04-05-PackedBitFieldsOverlap-2.cpp 2007-04-05-PackedBitFieldsOverlap.cpp 2007-04-05-PackedBitFieldsSmall.cpp 2007-04-05-StructPackedFieldUnpacked.cpp 2007-04-10-PackedUnion.cpp 2007-04-14-FNoBuiltin.cpp 2007-05-03-VectorInit.cpp 2007-07-29-RestrictPtrArg.cpp 2007-07-29-RestrictRefArg.cpp 2007-09-10-RecursiveTypeResolution.cpp
Eric Christopher
echristo at apple.com
Fri Aug 19 16:08:33 PDT 2011
Author: echristo
Date: Fri Aug 19 18:08:33 2011
New Revision: 138134
URL: http://llvm.org/viewvc/llvm-project?rev=138134&view=rev
Log:
Migrate:
2007-01-06-PtrMethodInit.cpp
2007-04-05-PackedBitFields-1.cpp
2007-04-05-PackedBitFieldsOverlap-2.cpp
2007-04-05-PackedBitFieldsOverlap.cpp
2007-04-05-PackedBitFieldsSmall.cpp
2007-04-05-StructPackedFieldUnpacked.cpp
2007-04-10-PackedUnion.cpp
2007-04-14-FNoBuiltin.cpp
2007-05-03-VectorInit.cpp
2007-07-29-RestrictPtrArg.cpp
2007-07-29-RestrictRefArg.cpp
2007-09-10-RecursiveTypeResolution.cpp
from llvm/test/FrontendC++ and FileCheckize where appropriate.
Added:
cfe/trunk/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp
cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp
cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp
cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp
cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp
cfe/trunk/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp
cfe/trunk/test/CodeGenCXX/2007-04-10-PackedUnion.cpp
cfe/trunk/test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp
cfe/trunk/test/CodeGenCXX/2007-05-03-VectorInit.cpp
cfe/trunk/test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp
cfe/trunk/test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp
cfe/trunk/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp
Added: cfe/trunk/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,75 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+// PR1084
+
+extern "C"
+{
+ typedef unsigned char PRUint8;
+ typedef unsigned int PRUint32;
+}
+typedef PRUint32 nsresult;
+struct nsID
+{
+};
+typedef nsID nsIID;
+class nsISupports
+{
+};
+extern "C++"
+{
+ template < class T > struct nsCOMTypeInfo
+ {
+ static const nsIID & GetIID ()
+ {
+ }
+ };
+}
+
+class nsIDOMEvent:public nsISupports
+{
+};
+class nsIDOMEventListener:public nsISupports
+{
+public:static const nsIID & GetIID ()
+ {
+ }
+ virtual nsresult
+ __attribute__ ((regparm (0), cdecl)) HandleEvent (nsIDOMEvent * event) =
+ 0;
+};
+class nsIDOMMouseListener:public nsIDOMEventListener
+{
+public:static const nsIID & GetIID ()
+ {
+ static const nsIID iid = {
+ };
+ }
+ virtual nsresult
+ __attribute__ ((regparm (0),
+ cdecl)) MouseDown (nsIDOMEvent * aMouseEvent) = 0;
+};
+typedef
+typeof (&nsIDOMEventListener::HandleEvent)
+ GenericHandler;
+ struct EventDispatchData
+ {
+ PRUint32 message;
+ GenericHandler method;
+ PRUint8 bits;
+ };
+ struct EventTypeData
+ {
+ const EventDispatchData *events;
+ int numEvents;
+ const nsIID *iid;
+ };
+ static const EventDispatchData sMouseEvents[] = {
+ {
+ (300 + 2),
+ reinterpret_cast < GenericHandler > (&nsIDOMMouseListener::MouseDown),
+ 0x01}
+ };
+static const EventTypeData sEventTypes[] = {
+ {
+ sMouseEvents, (sizeof (sMouseEvents) / sizeof (sMouseEvents[0])),
+ &nsCOMTypeInfo < nsIDOMMouseListener >::GetIID ()}
+};
Added: cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+#ifdef PACKED
+#define P __attribute__((packed))
+#else
+#define P
+#endif
+
+struct P M_Packed {
+ unsigned int l_Packed;
+ unsigned short k_Packed : 6,
+ i_Packed : 15,
+ j_Packed : 11;
+
+};
+
+struct M_Packed sM_Packed;
+
+int testM_Packed (void) {
+ struct M_Packed x;
+ return (x.i_Packed != 0);
+}
Added: cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+#ifdef PACKED
+#define P __attribute__((packed))
+#else
+#define P
+#endif
+
+struct P M_Packed {
+ unsigned long sorted : 1;
+ unsigned long from_array : 1;
+ unsigned long mixed_encoding : 1;
+ unsigned long encoding : 8;
+ unsigned long count : 21;
+
+};
+
+struct M_Packed sM_Packed;
+
+int testM_Packed (void) {
+ struct M_Packed x;
+ return (x.count != 0);
+}
Added: cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+
+#ifdef PACKED
+#define P __attribute__((packed))
+#else
+#define P
+#endif
+
+struct P M_Packed {
+ unsigned int l_Packed;
+ unsigned short k_Packed : 6,
+ i_Packed : 15;
+ char c;
+
+};
+
+struct M_Packed sM_Packed;
+
+int testM_Packed (void) {
+ struct M_Packed x;
+ return (x.i_Packed != 0);
+}
Added: cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+
+#ifdef PACKED
+// This is an example where size of Packed struct is smaller then
+// the size of bit field type.
+#define P __attribute__((packed))
+#else
+#define P
+#endif
+
+struct P M_Packed {
+ unsigned long long X:50;
+ unsigned Y:2;
+};
+
+struct M_Packed sM_Packed;
+
+int testM_Packed (void) {
+ struct M_Packed x;
+ return (0 != x.Y);
+}
+
+int testM_Packed2 (void) {
+ struct M_Packed x;
+ return (0 != x.X);
+}
Added: cfe/trunk/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+#ifdef PACKED
+#define P __attribute__((packed))
+#else
+#define P
+#endif
+
+struct UnPacked {
+ int X;
+ int Y;
+};
+
+struct P M_Packed {
+ unsigned char A;
+ struct UnPacked B;
+};
+
+struct M_Packed sM_Packed;
+
+int testM_Packed (void) {
+ struct M_Packed x;
+ return (x.B.Y != 0);
+}
Added: cfe/trunk/test/CodeGenCXX/2007-04-10-PackedUnion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-04-10-PackedUnion.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-04-10-PackedUnion.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-04-10-PackedUnion.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,41 @@
+// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
+extern "C" {
+
+#pragma pack(push, 2)
+ typedef struct ABC* abc;
+
+ struct ABCS {
+ float red;
+ float green;
+ float blue;
+ float alpha;
+ };
+
+ typedef void (*XYZ)();
+#pragma pack(pop)
+}
+
+
+union ABCU {
+ ABCS color;
+ XYZ bg;
+};
+
+struct AData {
+ ABCU data;
+};
+
+class L {
+ public:
+ L() {}
+ L(const L& other);
+
+ private:
+ AData fdata;
+};
+
+
+L::L(const L& other)
+{
+ fdata = other.fdata;
+}
Added: cfe/trunk/test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm %s -fno-builtin -o - | FileCheck %s
+// Check that -fno-builtin is honored.
+
+extern "C" int printf(const char*, ...);
+void foo(const char *msg) {
+ // CHECK: call{{.*}}printf
+ printf("%s\n",msg);
+}
Added: cfe/trunk/test/CodeGenCXX/2007-05-03-VectorInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-05-03-VectorInit.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-05-03-VectorInit.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-05-03-VectorInit.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -emit-llvm %s -O0 -o -
+// PR1378
+
+typedef float v4sf __attribute__((vector_size(16)));
+
+typedef v4sf float4;
+
+static float4 splat4(float a)
+{
+ float4 tmp = {a,a,a,a};
+ return tmp;
+}
+
+float4 foo(float a)
+{
+ return splat4(a);
+}
Added: cfe/trunk/test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+void foo(int * __restrict myptr1, int * myptr2) {
+ // CHECK: noalias
+ myptr1[0] = 0;
+ myptr2[0] = 0;
+}
Added: cfe/trunk/test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+void foo(int & __restrict myptr1, int & myptr2) {
+ // CHECK: noalias
+ myptr1 = 0;
+ myptr2 = 0;
+}
Added: cfe/trunk/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp?rev=138134&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp Fri Aug 19 18:08:33 2011
@@ -0,0 +1,87 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+// PR1634
+
+namespace Manta
+{
+ class CallbackHandle
+ {
+ protected:virtual ~ CallbackHandle (void)
+ {
+ }
+ };
+template < typename Data1 > class CallbackBase_1Data:public CallbackHandle
+ {
+ };
+}
+
+namespace __gnu_cxx
+{
+ template < typename _Iterator, typename _Container >
+ class __normal_iterator
+ {
+ _Iterator _M_current;
+ };
+}
+
+namespace std
+{
+ template < typename _Tp > struct allocator
+ {
+ typedef _Tp *pointer;
+ };
+ template < typename _InputIterator,
+ typename _Tp > inline void find (_InputIterator __last,
+ const _Tp & __val)
+ {
+ };
+}
+
+namespace Manta
+{
+ template < typename _Tp, typename _Alloc> struct _Vector_base
+ {
+ struct _Vector_impl
+ {
+ _Tp *_M_start;
+ };
+ public:
+ _Vector_impl _M_impl;
+ };
+ template < typename _Tp, typename _Alloc = std::allocator < _Tp > >
+ class vector:protected _Vector_base < _Tp,_Alloc >
+ {
+ public:
+ typedef __gnu_cxx::__normal_iterator < typename _Alloc::pointer,
+ vector < _Tp, _Alloc > > iterator;
+ iterator end ()
+ {
+ }
+ };
+ class MantaInterface
+ {
+ };
+ class RTRT
+ {
+ virtual CallbackHandle *registerTerminationCallback (CallbackBase_1Data <
+ MantaInterface * >*);
+ virtual void unregisterCallback (CallbackHandle *);
+ typedef vector < CallbackBase_1Data < int >*>PRCallbackMapType;
+ PRCallbackMapType parallelPreRenderCallbacks;
+ };
+}
+using namespace Manta;
+CallbackHandle *
+RTRT::registerTerminationCallback (CallbackBase_1Data < MantaInterface * >*cb)
+{
+ return cb;
+}
+
+void
+RTRT::unregisterCallback (CallbackHandle * callback)
+{
+ {
+ typedef CallbackBase_1Data < int > callback_t;
+ callback_t *cb = static_cast < callback_t * >(callback);
+ find (parallelPreRenderCallbacks.end (), cb);
+ }
+}
More information about the cfe-commits
mailing list