Migrate, FileCheckize and update:

2004-03-08-ReinterpretCastCopy.cpp
2004-03-09-UnmangledBuiltinMethods.cpp
2004-03-15-CleanupsAndGotos.cpp
2004-06-08-LateTemplateInstantiation.cpp
2004-09-27-CompilerCrash.cpp
2004-09-27-DidntEmitTemplate.cpp
2004-11-27-ExceptionCleanupAssertion.cpp
2004-11-27-FriendDefaultArgCrash.cpp
2005-01-03-StaticInitializers.cpp

from llvm/test/FrontendC++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138157 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp b/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp
new file mode 100644
index 0000000..a6e2e30
--- /dev/null
+++ b/test/CodeGenCXX/2004-03-08-ReinterpretCastCopy.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+struct A {
+  virtual void Method() = 0;
+};
+
+struct B : public A {
+  virtual void Method() { }
+};
+
+typedef void (A::*fn_type_a)(void);
+typedef void (B::*fn_type_b)(void);
+
+int main(int argc, char **argv)
+{
+  fn_type_a f = reinterpret_cast<fn_type_a>(&B::Method);
+  fn_type_b g = reinterpret_cast<fn_type_b>(f);
+  B b;
+  (b.*g)();
+  return 0;
+}
diff --git a/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp b/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp
new file mode 100644
index 0000000..5d8c8b0
--- /dev/null
+++ b/test/CodeGenCXX/2004-03-09-UnmangledBuiltinMethods.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: _ZN11AccessFlags6strlenEv
+struct AccessFlags {
+  void strlen();
+};
+
+void AccessFlags::strlen() { }
diff --git a/test/CodeGenCXX/2004-03-15-CleanupsAndGotos.cpp b/test/CodeGenCXX/2004-03-15-CleanupsAndGotos.cpp
new file mode 100644
index 0000000..01350c0
--- /dev/null
+++ b/test/CodeGenCXX/2004-03-15-CleanupsAndGotos.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+// Testcase from Bug 291
+
+struct X {
+  ~X();
+};
+
+void foo() {
+  X v;
+
+TryAgain:
+  goto TryAgain;
+}
diff --git a/test/CodeGenCXX/2004-06-08-LateTemplateInstantiation.cpp b/test/CodeGenCXX/2004-06-08-LateTemplateInstantiation.cpp
new file mode 100644
index 0000000..97254c1
--- /dev/null
+++ b/test/CodeGenCXX/2004-06-08-LateTemplateInstantiation.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+
+template<typename Ty>
+struct normal_iterator {
+  int FIELD;
+};
+
+void foo(normal_iterator<int>);
+normal_iterator<int> baz();
+
+void bar() {
+  foo(baz());
+}
+
+void *bar2() {
+  return (void*)foo;
+}
diff --git a/test/CodeGenCXX/2004-09-27-CompilerCrash.cpp b/test/CodeGenCXX/2004-09-27-CompilerCrash.cpp
new file mode 100644
index 0000000..5e5af4a
--- /dev/null
+++ b/test/CodeGenCXX/2004-09-27-CompilerCrash.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -emit-llvm %s -o -
+
+struct Pass {} ;
+template<typename PassName>
+Pass *callDefaultCtor() { return new PassName(); }
+
+void foo(Pass *(*C)());
+
+#include <string>
+
+bool foo(std::string &X) {
+  return X.empty();
+}
diff --git a/test/CodeGenCXX/2004-09-27-DidntEmitTemplate.cpp b/test/CodeGenCXX/2004-09-27-DidntEmitTemplate.cpp
new file mode 100644
index 0000000..618894f
--- /dev/null
+++ b/test/CodeGenCXX/2004-09-27-DidntEmitTemplate.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// This is a testcase for LLVM PR445, which was a problem where the
+// instantiation of callDefaultCtor was not being emitted correctly.
+
+// CHECK-NOT: declare{{.*}}callDefaultCtor
+struct Pass {};
+
+template<typename PassName>
+Pass *callDefaultCtor() { return new Pass(); }
+
+void foo(Pass *(*C)());
+
+struct basic_string {
+  bool empty() const { return true; }
+};
+
+
+bool foo2(basic_string &X) {
+  return X.empty();
+}
+void baz() { foo(callDefaultCtor<Pass>); }
diff --git a/test/CodeGenCXX/2004-11-27-ExceptionCleanupAssertion.cpp b/test/CodeGenCXX/2004-11-27-ExceptionCleanupAssertion.cpp
new file mode 100644
index 0000000..ebcce77
--- /dev/null
+++ b/test/CodeGenCXX/2004-11-27-ExceptionCleanupAssertion.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -emit-llvm -o /dev/null
+
+// This is PR421
+
+struct Strongbad {
+    Strongbad(const char *str );
+    ~Strongbad();
+    operator const char *() const;
+};
+
+void TheCheat () {
+  Strongbad foo(0);
+  Strongbad dirs[] = { Strongbad(0) + 1};
+}
diff --git a/test/CodeGenCXX/2004-11-27-FriendDefaultArgCrash.cpp b/test/CodeGenCXX/2004-11-27-FriendDefaultArgCrash.cpp
new file mode 100644
index 0000000..3bfecd5
--- /dev/null
+++ b/test/CodeGenCXX/2004-11-27-FriendDefaultArgCrash.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
+
+// PR447
+
+namespace nm {
+  struct str {
+    friend int foo(int arg = 0);
+  };
+}
diff --git a/test/CodeGenCXX/2005-01-03-StaticInitializers.cpp b/test/CodeGenCXX/2005-01-03-StaticInitializers.cpp
new file mode 100644
index 0000000..875c412
--- /dev/null
+++ b/test/CodeGenCXX/2005-01-03-StaticInitializers.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+struct S {
+  int  A[2];
+};
+
+// CHECK-NOT: llvm.global_ctor
+int XX = (int)(long)&(((struct S*)0)->A[1]);