]> granicus.if.org Git - clang/commitdiff
Migrate:
authorEric Christopher <echristo@apple.com>
Fri, 19 Aug 2011 23:08:33 +0000 (23:08 +0000)
committerEric Christopher <echristo@apple.com>
Fri, 19 Aug 2011 23:08:33 +0000 (23:08 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138134 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-04-10-PackedUnion.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-05-03-VectorInit.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp [new file with mode: 0644]
test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp [new file with mode: 0644]

diff --git a/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp b/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp
new file mode 100644 (file)
index 0000000..f3aa51e
--- /dev/null
@@ -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 ()}
+};
diff --git a/test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp b/test/CodeGenCXX/2007-04-05-PackedBitFields-1.cpp
new file mode 100644 (file)
index 0000000..6c39b55
--- /dev/null
@@ -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);
+}
diff --git a/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp b/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap-2.cpp
new file mode 100644 (file)
index 0000000..d7b0eae
--- /dev/null
@@ -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);
+}
diff --git a/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp b/test/CodeGenCXX/2007-04-05-PackedBitFieldsOverlap.cpp
new file mode 100644 (file)
index 0000000..6911767
--- /dev/null
@@ -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);
+}
diff --git a/test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp b/test/CodeGenCXX/2007-04-05-PackedBitFieldsSmall.cpp
new file mode 100644 (file)
index 0000000..b31f95f
--- /dev/null
@@ -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);
+}
diff --git a/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp b/test/CodeGenCXX/2007-04-05-StructPackedFieldUnpacked.cpp
new file mode 100644 (file)
index 0000000..c848e7c
--- /dev/null
@@ -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);
+}
diff --git a/test/CodeGenCXX/2007-04-10-PackedUnion.cpp b/test/CodeGenCXX/2007-04-10-PackedUnion.cpp
new file mode 100644 (file)
index 0000000..863fc82
--- /dev/null
@@ -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;
+}
diff --git a/test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp b/test/CodeGenCXX/2007-04-14-FNoBuiltin.cpp
new file mode 100644 (file)
index 0000000..4475fda
--- /dev/null
@@ -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);
+}
diff --git a/test/CodeGenCXX/2007-05-03-VectorInit.cpp b/test/CodeGenCXX/2007-05-03-VectorInit.cpp
new file mode 100644 (file)
index 0000000..5bc196f
--- /dev/null
@@ -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);
+}
diff --git a/test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp b/test/CodeGenCXX/2007-07-29-RestrictPtrArg.cpp
new file mode 100644 (file)
index 0000000..d7c96f5
--- /dev/null
@@ -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;
+}
diff --git a/test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp b/test/CodeGenCXX/2007-07-29-RestrictRefArg.cpp
new file mode 100644 (file)
index 0000000..aa9f48b
--- /dev/null
@@ -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;
+}
diff --git a/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp b/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp
new file mode 100644 (file)
index 0000000..ec8a516
--- /dev/null
@@ -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);
+  }
+}