aboutsummaryrefslogtreecommitdiffstats
path: root/test/FrontendC++
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-05-29 19:17:15 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-05-29 19:17:15 +0000
commite6ccd113b9ad7c40aa5f71e526537bbeac33d80b (patch)
tree9059e4d73006c90d725ee560da049a3ff6b66691 /test/FrontendC++
parent885f9d99645c58cffc35e6e4d4d3c9baa4cb0f15 (diff)
downloadexternal_llvm-e6ccd113b9ad7c40aa5f71e526537bbeac33d80b.zip
external_llvm-e6ccd113b9ad7c40aa5f71e526537bbeac33d80b.tar.gz
external_llvm-e6ccd113b9ad7c40aa5f71e526537bbeac33d80b.tar.bz2
For PR1338: Rename test dirs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51695 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FrontendC++')
-rw-r--r--test/FrontendC++/2003-08-20-ExceptionFail.cpp12
-rw-r--r--test/FrontendC++/2003-08-21-EmptyClass.cpp9
-rw-r--r--test/FrontendC++/2003-08-24-Cleanup.cpp10
-rw-r--r--test/FrontendC++/2003-08-27-TypeNamespaces.cpp16
-rw-r--r--test/FrontendC++/2003-08-28-ForwardType.cpp23
-rw-r--r--test/FrontendC++/2003-08-28-SaveExprBug.cpp24
-rw-r--r--test/FrontendC++/2003-08-29-ArgPassingBug.cpp13
-rw-r--r--test/FrontendC++/2003-08-31-StructLayout.cpp16
-rw-r--r--test/FrontendC++/2003-09-22-CompositeExprValue.cpp11
-rw-r--r--test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp17
-rw-r--r--test/FrontendC++/2003-09-30-CommaExprBug.cpp10
-rw-r--r--test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp10
-rw-r--r--test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp12
-rw-r--r--test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp12
-rw-r--r--test/FrontendC++/2003-10-17-BoolBitfields.cpp11
-rw-r--r--test/FrontendC++/2003-10-21-InnerClass.cpp12
-rw-r--r--test/FrontendC++/2003-10-27-VirtualBaseClassCrash.cpp17
-rw-r--r--test/FrontendC++/2003-11-02-WeakLinkage.cpp13
-rw-r--r--test/FrontendC++/2003-11-04-ArrayConstructors.cpp12
-rw-r--r--test/FrontendC++/2003-11-04-CatchLabelName.cpp11
-rw-r--r--test/FrontendC++/2003-11-08-ArrayAddress.cpp10
-rw-r--r--test/FrontendC++/2003-11-09-ConstructorTypeSafety.cpp21
-rw-r--r--test/FrontendC++/2003-11-18-EnumArray.cpp14
-rw-r--r--test/FrontendC++/2003-11-18-MemberInitializationCasting.cpp13
-rw-r--r--test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp14
-rw-r--r--test/FrontendC++/2003-11-25-ReturningOpaqueByValue.cpp12
-rw-r--r--test/FrontendC++/2003-11-27-MultipleInheritanceThunk.cpp28
-rw-r--r--test/FrontendC++/2003-11-29-DuplicatedCleanupTest.cpp41
-rw-r--r--test/FrontendC++/2003-12-08-ArrayOfPtrToMemberFunc.cpp12
-rw-r--r--test/FrontendC++/2004-01-11-DynamicInitializedConstant.cpp6
-rw-r--r--test/FrontendC++/2004-03-08-ReinterpretCastCopy.cpp21
-rw-r--r--test/FrontendC++/2004-03-09-UnmangledBuiltinMethods.cpp8
-rw-r--r--test/FrontendC++/2004-03-15-CleanupsAndGotos.cpp14
-rw-r--r--test/FrontendC++/2004-06-08-LateTemplateInstantiation.cpp19
-rw-r--r--test/FrontendC++/2004-09-27-CompilerCrash.cpp13
-rw-r--r--test/FrontendC++/2004-09-27-DidntEmitTemplate.cpp23
-rw-r--r--test/FrontendC++/2004-11-27-EmitsUnusedInlineFunctions.cpp7
-rw-r--r--test/FrontendC++/2004-11-27-ExceptionCleanupAssertion.cpp14
-rw-r--r--test/FrontendC++/2004-11-27-FriendDefaultArgCrash.cpp9
-rw-r--r--test/FrontendC++/2004-11-27-InlineAsmFunctionRedefinition.cpp26
-rw-r--r--test/FrontendC++/2005-01-03-StaticInitializers.cpp8
-rw-r--r--test/FrontendC++/2005-02-11-AnonymousUnion.cpp32
-rw-r--r--test/FrontendC++/2005-02-13-BadDynamicInit.cpp9
-rw-r--r--test/FrontendC++/2005-02-14-BitFieldOffset.cpp11
-rw-r--r--test/FrontendC++/2005-02-19-BitfieldStructCrash.cpp14
-rw-r--r--test/FrontendC++/2005-02-19-UnnamedVirtualThunkArgument.cpp22
-rw-r--r--test/FrontendC++/2005-02-20-BrokenReferenceTest.cpp11
-rw-r--r--test/FrontendC++/2005-02-27-PlacementArrayNewCrash.cpp8
-rw-r--r--test/FrontendC++/2005-07-21-VirtualBaseAccess.cpp14
-rw-r--r--test/FrontendC++/2006-03-01-GimplifyCrash.cpp14
-rw-r--r--test/FrontendC++/2006-03-06-C++RecurseCrash.cpp24
-rw-r--r--test/FrontendC++/2006-09-08-powi.cpp7
-rw-r--r--test/FrontendC++/2006-09-12-OpaqueStructCrash.cpp28
-rw-r--r--test/FrontendC++/2006-09-27-Debug-Protection.cpp13
-rw-r--r--test/FrontendC++/2006-10-30-ClassBitfield.cpp16
-rw-r--r--test/FrontendC++/2006-11-06-StackTrace.cpp36
-rw-r--r--test/FrontendC++/2006-11-20-GlobalSymbols.cpp10
-rw-r--r--test/FrontendC++/2006-11-30-ConstantExprCrash.cpp27
-rw-r--r--test/FrontendC++/2006-11-30-NoCompileUnit.cpp58
-rw-r--r--test/FrontendC++/2006-11-30-Pubnames.cpp20
-rw-r--r--test/FrontendC++/2007-01-02-UnboundedArray.cpp14
-rw-r--r--test/FrontendC++/2007-01-06-ELF-Thunk-Sections.cpp49
-rw-r--r--test/FrontendC++/2007-01-06-PtrMethodInit.cpp75
-rw-r--r--test/FrontendC++/2007-03-27-FunctionVarRename.cpp17
-rw-r--r--test/FrontendC++/2007-04-05-PackedBitFields-1.cpp23
-rw-r--r--test/FrontendC++/2007-04-05-PackedBitFieldsOverlap-2.cpp24
-rw-r--r--test/FrontendC++/2007-04-05-PackedBitFieldsOverlap.cpp24
-rw-r--r--test/FrontendC++/2007-04-05-PackedBitFieldsSmall.cpp27
-rw-r--r--test/FrontendC++/2007-04-05-StructPackedFieldUnpacked.cpp25
-rw-r--r--test/FrontendC++/2007-04-10-PackedUnion.cpp41
-rw-r--r--test/FrontendC++/2007-04-11-InlineStorageClassC++.cpp44
-rw-r--r--test/FrontendC++/2007-04-14-FNoBuiltin.cpp7
-rw-r--r--test/FrontendC++/2007-04-31-TryCatch.cpp12
-rw-r--r--test/FrontendC++/2007-05-03-VectorInit.cpp17
-rw-r--r--test/FrontendC++/2007-05-16-ReverseBitFieldCrash.cpp24
-rw-r--r--test/FrontendC++/2007-05-23-TryFinally.cpp16
-rw-r--r--test/FrontendC++/2007-07-04-NestedCatches.cpp32
-rw-r--r--test/FrontendC++/2007-07-29-RestrictPtrArg.cpp6
-rw-r--r--test/FrontendC++/2007-07-29-RestrictRefArg.cpp6
-rw-r--r--test/FrontendC++/2007-08-01-RestrictMethod.cpp13
-rw-r--r--test/FrontendC++/2007-09-10-RecursiveTypeResolution.cpp88
-rw-r--r--test/FrontendC++/2007-10-01-StructResize.cpp14
-rw-r--r--test/FrontendC++/2008-01-11-BadWarning.cpp6
-rw-r--r--test/FrontendC++/2008-01-12-VecInit.cpp6
-rw-r--r--test/FrontendC++/2008-02-13-sret.cpp41
-rw-r--r--test/FrontendC++/2008-05-07-CrazyOffsetOf.cpp8
-rw-r--r--test/FrontendC++/dg.exp5
-rw-r--r--test/FrontendC++/ptr-to-method-devirt.cpp14
88 files changed, 1656 insertions, 0 deletions
diff --git a/test/FrontendC++/2003-08-20-ExceptionFail.cpp b/test/FrontendC++/2003-08-20-ExceptionFail.cpp
new file mode 100644
index 0000000..fd1c6ad
--- /dev/null
+++ b/test/FrontendC++/2003-08-20-ExceptionFail.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+void foo();
+
+void bar() {
+ struct local {
+ ~local() { foo(); }
+ } local_obj;
+
+ foo();
+}
+
diff --git a/test/FrontendC++/2003-08-21-EmptyClass.cpp b/test/FrontendC++/2003-08-21-EmptyClass.cpp
new file mode 100644
index 0000000..2f90b3a
--- /dev/null
+++ b/test/FrontendC++/2003-08-21-EmptyClass.cpp
@@ -0,0 +1,9 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+// This tests compilation of EMPTY_CLASS_EXPR's
+
+struct empty {};
+
+void foo(empty) {}
+
+void bar() { foo(empty()); }
diff --git a/test/FrontendC++/2003-08-24-Cleanup.cpp b/test/FrontendC++/2003-08-24-Cleanup.cpp
new file mode 100644
index 0000000..ab0d1a0
--- /dev/null
+++ b/test/FrontendC++/2003-08-24-Cleanup.cpp
@@ -0,0 +1,10 @@
+// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep unwind
+
+struct S { ~S(); };
+
+int mightthrow();
+
+int test() {
+ S s;
+ mightthrow();
+}
diff --git a/test/FrontendC++/2003-08-27-TypeNamespaces.cpp b/test/FrontendC++/2003-08-27-TypeNamespaces.cpp
new file mode 100644
index 0000000..cd7247e
--- /dev/null
+++ b/test/FrontendC++/2003-08-27-TypeNamespaces.cpp
@@ -0,0 +1,16 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+namespace foo {
+ namespace bar {
+ struct X { X(); };
+
+ X::X() {}
+ }
+}
+
+
+namespace {
+ struct Y { Y(); };
+ Y::Y() {}
+}
diff --git a/test/FrontendC++/2003-08-28-ForwardType.cpp b/test/FrontendC++/2003-08-28-ForwardType.cpp
new file mode 100644
index 0000000..38c4e2d
--- /dev/null
+++ b/test/FrontendC++/2003-08-28-ForwardType.cpp
@@ -0,0 +1,23 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+// Default placement versions of operator new.
+#include <new>
+
+void* operator new(size_t, void* __p) throw();
+
+
+template<typename _CharT>
+struct stdio_filebuf
+{ stdio_filebuf();
+
+};
+
+extern stdio_filebuf<char> buf_cout;
+
+void foo() {
+ // Create stream buffers for the standard streams and use
+ // those buffers without destroying and recreating the
+ // streams.
+ new (&buf_cout) stdio_filebuf<char>();
+
+}
diff --git a/test/FrontendC++/2003-08-28-SaveExprBug.cpp b/test/FrontendC++/2003-08-28-SaveExprBug.cpp
new file mode 100644
index 0000000..2be35d8
--- /dev/null
+++ b/test/FrontendC++/2003-08-28-SaveExprBug.cpp
@@ -0,0 +1,24 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+char* eback();
+
+template<typename foo>
+struct basic_filebuf {
+ char *instancevar;
+
+ void callee() {
+ instancevar += eback() != eback();
+ }
+
+ void caller();
+};
+
+
+template<typename _CharT>
+void basic_filebuf<_CharT>::caller() {
+ callee();
+}
+
+
+template class basic_filebuf<char>;
diff --git a/test/FrontendC++/2003-08-29-ArgPassingBug.cpp b/test/FrontendC++/2003-08-29-ArgPassingBug.cpp
new file mode 100644
index 0000000..d4cddff
--- /dev/null
+++ b/test/FrontendC++/2003-08-29-ArgPassingBug.cpp
@@ -0,0 +1,13 @@
+
+// RUN: %llvmgcc -xc++ -c -o /dev/null %s |& not grep WARNING
+
+struct iterator {
+ iterator();
+ iterator(const iterator &I);
+};
+
+iterator foo(const iterator &I) { return I; }
+
+void test() {
+ foo(iterator());
+}
diff --git a/test/FrontendC++/2003-08-31-StructLayout.cpp b/test/FrontendC++/2003-08-31-StructLayout.cpp
new file mode 100644
index 0000000..99d6682
--- /dev/null
+++ b/test/FrontendC++/2003-08-31-StructLayout.cpp
@@ -0,0 +1,16 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+// There is a HOLE in the derived2 object due to not wanting to place the two
+// baseclass instances at the same offset!
+
+struct baseclass {};
+
+class derived1 : public baseclass {
+ void * NodePtr;
+};
+
+class derived2 : public baseclass {
+ derived1 current;
+};
+
+derived2 RI;
diff --git a/test/FrontendC++/2003-09-22-CompositeExprValue.cpp b/test/FrontendC++/2003-09-22-CompositeExprValue.cpp
new file mode 100644
index 0000000..a8208ad
--- /dev/null
+++ b/test/FrontendC++/2003-09-22-CompositeExprValue.cpp
@@ -0,0 +1,11 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+struct duration {
+ duration operator/=(int c) {
+ return *this;
+ }
+};
+
+void a000090() {
+ duration() /= 1;
+}
diff --git a/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp b/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp
new file mode 100644
index 0000000..4873123
--- /dev/null
+++ b/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp
@@ -0,0 +1,17 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+// Non-POD classes cannot be passed into a function by component, because their
+// dtors must be run. Instead, pass them in by reference. The C++ front-end
+// was mistakenly "thinking" that 'foo' took a structure by component.
+
+struct C {
+ int A, B;
+ ~C() {}
+};
+
+void foo(C b);
+
+void test(C *P) {
+ foo(*P);
+}
+
diff --git a/test/FrontendC++/2003-09-30-CommaExprBug.cpp b/test/FrontendC++/2003-09-30-CommaExprBug.cpp
new file mode 100644
index 0000000..afe470c
--- /dev/null
+++ b/test/FrontendC++/2003-09-30-CommaExprBug.cpp
@@ -0,0 +1,10 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+class Empty {};
+
+void foo(Empty E);
+
+void bar() {
+ foo(Empty());
+}
+
diff --git a/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp b/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp
new file mode 100644
index 0000000..40c9c87
--- /dev/null
+++ b/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp
@@ -0,0 +1,10 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+struct C {};
+
+C &foo();
+
+void foox() {
+ for (; ; foo());
+}
+
diff --git a/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp b/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp
new file mode 100644
index 0000000..e07eb42
--- /dev/null
+++ b/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+// Test with an opaque type
+
+struct C;
+
+C &foo();
+
+void foox() {
+ for (; ; foo());
+}
+
diff --git a/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp b/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp
new file mode 100644
index 0000000..b1c54b8
--- /dev/null
+++ b/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+// The C++ front-end thinks the two foo's are different, the LLVM emitter
+// thinks they are the same. The disconnect causes problems.
+
+void foo() { }
+
+void bar() {
+ void foo();
+
+ foo();
+}
diff --git a/test/FrontendC++/2003-10-17-BoolBitfields.cpp b/test/FrontendC++/2003-10-17-BoolBitfields.cpp
new file mode 100644
index 0000000..547a367
--- /dev/null
+++ b/test/FrontendC++/2003-10-17-BoolBitfields.cpp
@@ -0,0 +1,11 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+struct test {
+ bool A : 1;
+ bool B : 1;
+};
+
+void foo(test *T) {
+ T->B = true;
+}
+
diff --git a/test/FrontendC++/2003-10-21-InnerClass.cpp b/test/FrontendC++/2003-10-21-InnerClass.cpp
new file mode 100644
index 0000000..fadd51d
--- /dev/null
+++ b/test/FrontendC++/2003-10-21-InnerClass.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgcc -xc++ -S -o - %s | grep {struct.X::Y}
+struct X {
+
+ struct Y {
+ Y();
+ };
+
+};
+
+X::Y::Y() {
+
+}
diff --git a/test/FrontendC++/2003-10-27-VirtualBaseClassCrash.cpp b/test/FrontendC++/2003-10-27-VirtualBaseClassCrash.cpp
new file mode 100644
index 0000000..f9fc80e
--- /dev/null
+++ b/test/FrontendC++/2003-10-27-VirtualBaseClassCrash.cpp
@@ -0,0 +1,17 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+template<class T>
+struct super {
+ int Y;
+ void foo();
+};
+
+template <class T>
+struct test : virtual super<int> {};
+
+extern test<int> X;
+
+void foo() {
+ X.foo();
+}
diff --git a/test/FrontendC++/2003-11-02-WeakLinkage.cpp b/test/FrontendC++/2003-11-02-WeakLinkage.cpp
new file mode 100644
index 0000000..748ca63
--- /dev/null
+++ b/test/FrontendC++/2003-11-02-WeakLinkage.cpp
@@ -0,0 +1,13 @@
+// RUN: %llvmgcc -xc++ -S -o - %s | not grep weak
+// The template should compile to linkonce linkage, not weak linkage.
+
+template<class T>
+void thefunc();
+
+template<class T>
+inline void thefunc() {}
+
+void test() {
+ thefunc<int>();
+}
+
diff --git a/test/FrontendC++/2003-11-04-ArrayConstructors.cpp b/test/FrontendC++/2003-11-04-ArrayConstructors.cpp
new file mode 100644
index 0000000..4df4f9b
--- /dev/null
+++ b/test/FrontendC++/2003-11-04-ArrayConstructors.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+struct Foo {
+ Foo(int);
+ ~Foo();
+};
+void foo() {
+ struct {
+ Foo name;
+ } Int[] = { 1 };
+}
diff --git a/test/FrontendC++/2003-11-04-CatchLabelName.cpp b/test/FrontendC++/2003-11-04-CatchLabelName.cpp
new file mode 100644
index 0000000..8acf88d
--- /dev/null
+++ b/test/FrontendC++/2003-11-04-CatchLabelName.cpp
@@ -0,0 +1,11 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+#include <string>
+
+void bar();
+
+void test() {
+ try {
+ bar();
+ } catch (std::string) {}
+}
diff --git a/test/FrontendC++/2003-11-08-ArrayAddress.cpp b/test/FrontendC++/2003-11-08-ArrayAddress.cpp
new file mode 100644
index 0000000..9ad1b8f
--- /dev/null
+++ b/test/FrontendC++/2003-11-08-ArrayAddress.cpp
@@ -0,0 +1,10 @@
+// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep getelementptr
+
+struct foo {
+ int array[100];
+ void *getAddr(unsigned i);
+};
+
+void *foo::getAddr(unsigned i) {
+ return &array[i];
+}
diff --git a/test/FrontendC++/2003-11-09-ConstructorTypeSafety.cpp b/test/FrontendC++/2003-11-09-ConstructorTypeSafety.cpp
new file mode 100644
index 0000000..e6c09e5
--- /dev/null
+++ b/test/FrontendC++/2003-11-09-ConstructorTypeSafety.cpp
@@ -0,0 +1,21 @@
+// The code generated for this testcase should be completely typesafe!
+// RUN: %llvmgcc -xc++ -S -o - %s | llvm-as | opt -die | llvm-dis | \
+// RUN: notcast
+
+struct contained {
+ unsigned X;
+ contained();
+};
+
+struct base {
+ unsigned A, B;
+};
+
+struct derived : public base {
+ contained _M_value_field;
+};
+
+int test() {
+ derived X;
+}
+
diff --git a/test/FrontendC++/2003-11-18-EnumArray.cpp b/test/FrontendC++/2003-11-18-EnumArray.cpp
new file mode 100644
index 0000000..6eaf9d6
--- /dev/null
+++ b/test/FrontendC++/2003-11-18-EnumArray.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+enum TchkType {
+ tchkNum, tchkString, tchkSCN, tchkNone
+};
+
+struct Operator {
+ enum TchkType tchk[8];
+};
+
+struct Operator opTab[] = {
+ {{tchkNum, tchkNum, tchkString} }
+};
+
diff --git a/test/FrontendC++/2003-11-18-MemberInitializationCasting.cpp b/test/FrontendC++/2003-11-18-MemberInitializationCasting.cpp
new file mode 100644
index 0000000..cb66ba1
--- /dev/null
+++ b/test/FrontendC++/2003-11-18-MemberInitializationCasting.cpp
@@ -0,0 +1,13 @@
+// RUN: %llvmgcc -xc++ -S -o - %s | llvm-as | opt -die | llvm-dis | notcast
+
+struct A {
+ A() : i(0) {}
+ int getI() {return i;}
+ int i;
+};
+
+int f(int j)
+{
+ A a;
+ return j+a.getI();
+}
diff --git a/test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp b/test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp
new file mode 100644
index 0000000..ae76a6c
--- /dev/null
+++ b/test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+struct Gfx {
+ void opMoveSetShowText();
+};
+
+struct Operator {
+ void (Gfx::*func)();
+};
+
+Operator opTab[] = {
+ {&Gfx::opMoveSetShowText},
+};
+
diff --git a/test/FrontendC++/2003-11-25-ReturningOpaqueByValue.cpp b/test/FrontendC++/2003-11-25-ReturningOpaqueByValue.cpp
new file mode 100644
index 0000000..83fe1b3
--- /dev/null
+++ b/test/FrontendC++/2003-11-25-ReturningOpaqueByValue.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+#include <vector>
+std::vector<int> my_method ();
+
+int
+main ()
+{
+ my_method ();
+ return 0;
+}
+
diff --git a/test/FrontendC++/2003-11-27-MultipleInheritanceThunk.cpp b/test/FrontendC++/2003-11-27-MultipleInheritanceThunk.cpp
new file mode 100644
index 0000000..16026c3
--- /dev/null
+++ b/test/FrontendC++/2003-11-27-MultipleInheritanceThunk.cpp
@@ -0,0 +1,28 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+struct CallSite {
+ int X;
+
+ CallSite(const CallSite &CS);
+};
+
+struct AliasAnalysis {
+ int TD;
+
+ virtual int getModRefInfo(CallSite CS);
+};
+
+
+struct Pass {
+ int X;
+ virtual int foo();
+};
+
+struct AliasAnalysisCounter : public Pass, public AliasAnalysis {
+ int getModRefInfo(CallSite CS) {
+ return 0;
+ }
+};
+
+AliasAnalysisCounter AAC;
diff --git a/test/FrontendC++/2003-11-29-DuplicatedCleanupTest.cpp b/test/FrontendC++/2003-11-29-DuplicatedCleanupTest.cpp
new file mode 100644
index 0000000..8131baa
--- /dev/null
+++ b/test/FrontendC++/2003-11-29-DuplicatedCleanupTest.cpp
@@ -0,0 +1,41 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+void doesntThrow() throw();
+struct F {
+ ~F() { doesntThrow(); }
+};
+
+void atest() {
+ F A;
+lab:
+ F B;
+ goto lab;
+}
+
+void test(int val) {
+label: {
+ F A;
+ F B;
+ if (val == 0) goto label;
+ if (val == 1) goto label;
+}
+}
+
+void test3(int val) {
+label: {
+ F A;
+ F B;
+ if (val == 0) { doesntThrow(); goto label; }
+ if (val == 1) { doesntThrow(); goto label; }
+}
+}
+
+void test4(int val) {
+label: {
+ F A;
+ F B;
+ if (val == 0) { F C; goto label; }
+ if (val == 1) { F D; goto label; }
+}
+}
diff --git a/test/FrontendC++/2003-12-08-ArrayOfPtrToMemberFunc.cpp b/test/FrontendC++/2003-12-08-ArrayOfPtrToMemberFunc.cpp
new file mode 100644
index 0000000..d512234
--- /dev/null
+++ b/test/FrontendC++/2003-12-08-ArrayOfPtrToMemberFunc.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+struct Evil {
+ void fun ();
+};
+int foo();
+typedef void (Evil::*memfunptr) ();
+static memfunptr jumpTable[] = { &Evil::fun };
+
+void Evil::fun() {
+ (this->*jumpTable[foo()]) ();
+}
diff --git a/test/FrontendC++/2004-01-11-DynamicInitializedConstant.cpp b/test/FrontendC++/2004-01-11-DynamicInitializedConstant.cpp
new file mode 100644
index 0000000..8ae15c9
--- /dev/null
+++ b/test/FrontendC++/2004-01-11-DynamicInitializedConstant.cpp
@@ -0,0 +1,6 @@
+// RUN: %llvmgcc -xc++ -S -o - %s | not grep { constant }
+
+extern int X;
+const int Y = X;
+const int* foo() { return &Y; }
+
diff --git a/test/FrontendC++/2004-03-08-ReinterpretCastCopy.cpp b/test/FrontendC++/2004-03-08-ReinterpretCastCopy.cpp
new file mode 100644
index 0000000..755d7c7
--- /dev/null
+++ b/test/FrontendC++/2004-03-08-ReinterpretCastCopy.cpp
@@ -0,0 +1,21 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+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/FrontendC++/2004-03-09-UnmangledBuiltinMethods.cpp b/test/FrontendC++/2004-03-09-UnmangledBuiltinMethods.cpp
new file mode 100644
index 0000000..b019e0c
--- /dev/null
+++ b/test/FrontendC++/2004-03-09-UnmangledBuiltinMethods.cpp
@@ -0,0 +1,8 @@
+// RUN: %llvmgcc -xc++ -c -o - %s | llvm-dis | grep _ZN11AccessFlags6strlenEv
+
+struct AccessFlags {
+ void strlen();
+};
+
+void AccessFlags::strlen() { }
+
diff --git a/test/FrontendC++/2004-03-15-CleanupsAndGotos.cpp b/test/FrontendC++/2004-03-15-CleanupsAndGotos.cpp
new file mode 100644
index 0000000..9bc70c8
--- /dev/null
+++ b/test/FrontendC++/2004-03-15-CleanupsAndGotos.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+// Testcase from Bug 291
+
+struct X {
+ ~X();
+};
+
+void foo() {
+ X v;
+
+TryAgain:
+ goto TryAgain;
+}
diff --git a/test/FrontendC++/2004-06-08-LateTemplateInstantiation.cpp b/test/FrontendC++/2004-06-08-LateTemplateInstantiation.cpp
new file mode 100644
index 0000000..16d8e5e
--- /dev/null
+++ b/test/FrontendC++/2004-06-08-LateTemplateInstantiation.cpp
@@ -0,0 +1,19 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+
+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/FrontendC++/2004-09-27-CompilerCrash.cpp b/test/FrontendC++/2004-09-27-CompilerCrash.cpp
new file mode 100644
index 0000000..f507c23
--- /dev/null
+++ b/test/FrontendC++/2004-09-27-CompilerCrash.cpp
@@ -0,0 +1,13 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+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/FrontendC++/2004-09-27-DidntEmitTemplate.cpp b/test/FrontendC++/2004-09-27-DidntEmitTemplate.cpp
new file mode 100644
index 0000000..706d541
--- /dev/null
+++ b/test/FrontendC++/2004-09-27-DidntEmitTemplate.cpp
@@ -0,0 +1,23 @@
+// RUN: %llvmgxx -xc++ %s -c -o - | llvm-dis | grep callDefaultCtor | \
+// RUN: not grep declare
+
+// This is a testcase for LLVM PR445, which was a problem where the
+// instantiation of callDefaultCtor was not being emitted correctly.
+
+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/FrontendC++/2004-11-27-EmitsUnusedInlineFunctions.cpp b/test/FrontendC++/2004-11-27-EmitsUnusedInlineFunctions.cpp
new file mode 100644
index 0000000..794b7d7
--- /dev/null
+++ b/test/FrontendC++/2004-11-27-EmitsUnusedInlineFunctions.cpp
@@ -0,0 +1,7 @@
+// The C++ front-end was emitting WAY too many inline functions. This test
+// verifies that it does not emit the body of getchar, because it is not used.
+// This corresponds to PR459
+
+// RUN: %llvmgxx %s -S -o - | not grep {^i32 .getchar}
+
+#include <stdio.h>
diff --git a/test/FrontendC++/2004-11-27-ExceptionCleanupAssertion.cpp b/test/FrontendC++/2004-11-27-ExceptionCleanupAssertion.cpp
new file mode 100644
index 0000000..f3d225e
--- /dev/null
+++ b/test/FrontendC++/2004-11-27-ExceptionCleanupAssertion.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx %s -S -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/FrontendC++/2004-11-27-FriendDefaultArgCrash.cpp b/test/FrontendC++/2004-11-27-FriendDefaultArgCrash.cpp
new file mode 100644
index 0000000..731e726
--- /dev/null
+++ b/test/FrontendC++/2004-11-27-FriendDefaultArgCrash.cpp
@@ -0,0 +1,9 @@
+// RUN: %llvmgxx %s -o /dev/null -S
+
+// PR447
+
+namespace nm {
+ struct str {
+ friend int foo(int arg = 0);
+ };
+}
diff --git a/test/FrontendC++/2004-11-27-InlineAsmFunctionRedefinition.cpp b/test/FrontendC++/2004-11-27-InlineAsmFunctionRedefinition.cpp
new file mode 100644
index 0000000..42b223b
--- /dev/null
+++ b/test/FrontendC++/2004-11-27-InlineAsmFunctionRedefinition.cpp
@@ -0,0 +1,26 @@
+// RUN: %llvmgxx %s -S -o /dev/null
+
+// PR397
+
+struct stat { };
+struct stat64 { };
+
+extern "C" {
+
+extern int lstat(const char *, struct stat *) __asm__("lstat64");
+extern int lstat64(const char *, struct stat64 *);
+
+extern int __lxstat(int, const char *, struct stat *) __asm__("__lxstat64");
+extern int __lxstat64(int, const char *, struct stat64 *);
+
+extern __inline__ int lstat(const char *path, struct stat *statbuf) {
+ return __lxstat(3, path, statbuf);
+}
+extern __inline__ int lstat64(const char *path, struct stat64 *statbuf) {
+ return __lxstat64(3, path, statbuf);
+}
+}
+
+int do_one_file(void) {
+ return lstat(0, 0) + lstat64(0,0);
+}
diff --git a/test/FrontendC++/2005-01-03-StaticInitializers.cpp b/test/FrontendC++/2005-01-03-StaticInitializers.cpp
new file mode 100644
index 0000000..da1b005
--- /dev/null
+++ b/test/FrontendC++/2005-01-03-StaticInitializers.cpp
@@ -0,0 +1,8 @@
+// RUN: %llvmgxx %s -S -o - | not grep llvm.global_ctor
+
+struct S {
+ int A[2];
+};
+
+int XX = (int)(long)&(((struct S*)0)->A[1]);
+
diff --git a/test/FrontendC++/2005-02-11-AnonymousUnion.cpp b/test/FrontendC++/2005-02-11-AnonymousUnion.cpp
new file mode 100644
index 0000000..b0ff7e7
--- /dev/null
+++ b/test/FrontendC++/2005-02-11-AnonymousUnion.cpp
@@ -0,0 +1,32 @@
+// RUN: %llvmgxx %s -S -o -
+
+// Test anonymous union with members of the same size.
+int test1(float F) {
+ union {
+ float G;
+ int i;
+ };
+ G = F;
+ return i;
+}
+
+// test anonymous union with members of differing size.
+int test2(short F) {
+ volatile union {
+ short G;
+ int i;
+ };
+ G = F;
+ return i;
+}
+
+// Make sure that normal unions work. duh :)
+volatile union {
+ short S;
+ int i;
+} U;
+
+int test3(short s) {
+ U.S = s;
+ return U.i;
+}
diff --git a/test/FrontendC++/2005-02-13-BadDynamicInit.cpp b/test/FrontendC++/2005-02-13-BadDynamicInit.cpp
new file mode 100644
index 0000000..84fa565
--- /dev/null
+++ b/test/FrontendC++/2005-02-13-BadDynamicInit.cpp
@@ -0,0 +1,9 @@
+// RUN: %llvmgxx %s -S -o - | not grep llvm.global_ctors
+// This testcase corresponds to PR509
+struct Data {
+ unsigned *data;
+ unsigned array[1];
+};
+
+Data shared_null = { shared_null.array };
+
diff --git a/test/FrontendC++/2005-02-14-BitFieldOffset.cpp b/test/FrontendC++/2005-02-14-BitFieldOffset.cpp
new file mode 100644
index 0000000..522e20a
--- /dev/null
+++ b/test/FrontendC++/2005-02-14-BitFieldOffset.cpp
@@ -0,0 +1,11 @@
+// RUN: %llvmgxx %s -S -o - | not grep {i32 6}
+
+struct QVectorTypedData {
+ int size;
+ unsigned int sharable : 1;
+ unsigned short array[1];
+};
+
+void foo(QVectorTypedData *X) {
+ X->array[0] = 123;
+}
diff --git a/test/FrontendC++/2005-02-19-BitfieldStructCrash.cpp b/test/FrontendC++/2005-02-19-BitfieldStructCrash.cpp
new file mode 100644
index 0000000..8f571e0
--- /dev/null
+++ b/test/FrontendC++/2005-02-19-BitfieldStructCrash.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -S %s -o -
+
+struct QChar {unsigned short X; QChar(unsigned short); } ;
+
+struct Command {
+ Command(QChar c) : c(c) {}
+ unsigned int type : 4;
+ QChar c;
+ };
+
+Command X(QChar('c'));
+
+void Foo(QChar );
+void bar() { Foo(X.c); }
diff --git a/test/FrontendC++/2005-02-19-UnnamedVirtualThunkArgument.cpp b/test/FrontendC++/2005-02-19-UnnamedVirtualThunkArgument.cpp
new file mode 100644
index 0000000..853fee7
--- /dev/null
+++ b/test/FrontendC++/2005-02-19-UnnamedVirtualThunkArgument.cpp
@@ -0,0 +1,22 @@
+// RUN: %llvmgxx -S %s -o /dev/null
+
+struct Foo {
+ Foo();
+ virtual ~Foo();
+};
+
+struct Bar {
+ Bar();
+ virtual ~Bar();
+ virtual bool test(bool) const;
+};
+
+struct Baz : public Foo, public Bar {
+ Baz();
+ virtual ~Baz();
+ virtual bool test(bool) const;
+};
+
+bool Baz::test(bool) const {
+ return true;
+}
diff --git a/test/FrontendC++/2005-02-20-BrokenReferenceTest.cpp b/test/FrontendC++/2005-02-20-BrokenReferenceTest.cpp
new file mode 100644
index 0000000..31026d3
--- /dev/null
+++ b/test/FrontendC++/2005-02-20-BrokenReferenceTest.cpp
@@ -0,0 +1,11 @@
+// RUN: %llvmgxx %s -S -o /dev/null
+
+void test(unsigned char *b, int rb) {
+ typedef unsigned char imgfoo[10][rb];
+ imgfoo &br = *(imgfoo *)b;
+
+ br[0][0] = 1;
+
+ rb = br[0][0];
+}
+
diff --git a/test/FrontendC++/2005-02-27-PlacementArrayNewCrash.cpp b/test/FrontendC++/2005-02-27-PlacementArrayNewCrash.cpp
new file mode 100644
index 0000000..a8fc668
--- /dev/null
+++ b/test/FrontendC++/2005-02-27-PlacementArrayNewCrash.cpp
@@ -0,0 +1,8 @@
+// RUN: %llvmgxx -S %s -o -
+
+#include <new>
+typedef double Ty[4];
+
+void foo(Ty *XX) {
+ new(XX) Ty();
+}
diff --git a/test/FrontendC++/2005-07-21-VirtualBaseAccess.cpp b/test/FrontendC++/2005-07-21-VirtualBaseAccess.cpp
new file mode 100644
index 0000000..7711cff
--- /dev/null
+++ b/test/FrontendC++/2005-07-21-VirtualBaseAccess.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -xc++ %s -c -o - | opt -die | llvm-dis | not grep cast
+
+void foo(int*);
+
+struct FOO {
+ int X;
+};
+
+struct BAR : virtual FOO { BAR(); };
+
+int testfn() {
+ BAR B;
+ foo(&B.X);
+}
diff --git a/test/FrontendC++/2006-03-01-GimplifyCrash.cpp b/test/FrontendC++/2006-03-01-GimplifyCrash.cpp
new file mode 100644
index 0000000..b0d00fe
--- /dev/null
+++ b/test/FrontendC++/2006-03-01-GimplifyCrash.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -S %s -o -
+
+struct PrefMapElem {
+ virtual ~PrefMapElem();
+ unsigned int fPrefId;
+};
+
+int foo() {
+ PrefMapElem* fMap;
+ if (fMap[0].fPrefId == 1)
+ return 1;
+
+ return 0;
+}
diff --git a/test/FrontendC++/2006-03-06-C++RecurseCrash.cpp b/test/FrontendC++/2006-03-06-C++RecurseCrash.cpp
new file mode 100644
index 0000000..2fb3fb7
--- /dev/null
+++ b/test/FrontendC++/2006-03-06-C++RecurseCrash.cpp
@@ -0,0 +1,24 @@
+// RUN: %llvmgcc %s -S -o -
+namespace std {
+ class exception { };
+
+ class type_info {
+ public:
+ virtual ~type_info();
+ };
+
+}
+
+namespace __cxxabiv1 {
+ class __si_class_type_info : public std::type_info {
+ ~__si_class_type_info();
+ };
+}
+
+class recursive_init: public std::exception {
+public:
+ virtual ~recursive_init() throw ();
+};
+
+recursive_init::~recursive_init() throw() { }
+
diff --git a/test/FrontendC++/2006-09-08-powi.cpp b/test/FrontendC++/2006-09-08-powi.cpp
new file mode 100644
index 0000000..75cbfda
--- /dev/null
+++ b/test/FrontendC++/2006-09-08-powi.cpp
@@ -0,0 +1,7 @@
+// RUN: %llvmgxx -O3 -S -o - %s
+
+#include <cmath>
+
+double foo(double X, int Y) {
+ return std::pow(X, Y);
+}
diff --git a/test/FrontendC++/2006-09-12-OpaqueStructCrash.cpp b/test/FrontendC++/2006-09-12-OpaqueStructCrash.cpp
new file mode 100644
index 0000000..f3160e8
--- /dev/null
+++ b/test/FrontendC++/2006-09-12-OpaqueStructCrash.cpp
@@ -0,0 +1,28 @@
+// RUN: %llvmgxx -O3 -S -o - %s
+
+struct A {
+ virtual ~A();
+};
+
+template <typename Ty>
+struct B : public A {
+ ~B () { delete [] val; }
+private:
+ Ty* val;
+};
+
+template <typename Ty>
+struct C : public A {
+ C ();
+ ~C ();
+};
+
+template <typename Ty>
+struct D : public A {
+ D () {}
+ private:
+ B<C<Ty> > blocks;
+};
+
+template class D<double>;
+
diff --git a/test/FrontendC++/2006-09-27-Debug-Protection.cpp b/test/FrontendC++/2006-09-27-Debug-Protection.cpp
new file mode 100644
index 0000000..d9a25aa
--- /dev/null
+++ b/test/FrontendC++/2006-09-27-Debug-Protection.cpp
@@ -0,0 +1,13 @@
+// RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep {i32 1,}
+// RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep {i32 2,}
+
+class A {
+public:
+ int x;
+protected:
+ int y;
+private:
+ int z;
+};
+
+A a;
diff --git a/test/FrontendC++/2006-10-30-ClassBitfield.cpp b/test/FrontendC++/2006-10-30-ClassBitfield.cpp
new file mode 100644
index 0000000..bd3b173
--- /dev/null
+++ b/test/FrontendC++/2006-10-30-ClassBitfield.cpp
@@ -0,0 +1,16 @@
+// RUN: %llvmgxx %s -emit-llvm -S -o -
+// PR954
+
+struct _Refcount_Base {
+ unsigned long _M_ref_count;
+ int _M_ref_count_lock;
+ _Refcount_Base() : _M_ref_count(0) {}
+};
+
+struct _Rope_RopeRep : public _Refcount_Base
+{
+public:
+ int _M_tag:8;
+};
+
+int foo(_Rope_RopeRep* r) { return r->_M_tag; }
diff --git a/test/FrontendC++/2006-11-06-StackTrace.cpp b/test/FrontendC++/2006-11-06-StackTrace.cpp
new file mode 100644
index 0000000..55b34ad
--- /dev/null
+++ b/test/FrontendC++/2006-11-06-StackTrace.cpp
@@ -0,0 +1,36 @@
+// This is a regression test on debug info to make sure that we can get a
+// meaningful stack trace from a C++ program.
+// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp-elim -o %t.s -f
+// RUN: %compile_c %t.s -o %t.o
+// RUN: %link %t.o -o %t.exe
+// RUN: echo {break DeepStack::deepest\nrun 17\nwhere\n} > %t.in
+// RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \
+// RUN: grep {#0 DeepStack::deepest.*(this=.*,.*x=33)}
+// RUN: gdb -q -batch -n -x %t.in %t.exe | \
+// RUN: grep {#7 0x.* in main.*(argc=\[12\],.*argv=.*)}
+
+// Only works on ppc, x86 and x86_64. Should generalize?
+// XFAIL: alpha|ia64|arm
+
+#include <stdlib.h>
+
+class DeepStack {
+ int seedVal;
+public:
+ DeepStack(int seed) : seedVal(seed) {}
+
+ int shallowest( int x ) { return shallower(x + 1); }
+ int shallower ( int x ) { return shallow(x + 2); }
+ int shallow ( int x ) { return deep(x + 3); }
+ int deep ( int x ) { return deeper(x + 4); }
+ int deeper ( int x ) { return deepest(x + 6); }
+ int deepest ( int x ) { return x + 7; }
+
+ int runit() { return shallowest(seedVal); }
+};
+
+int main ( int argc, char** argv) {
+
+ DeepStack DS9( (argc > 1 ? atoi(argv[1]) : 0) );
+ return DS9.runit();
+}
diff --git a/test/FrontendC++/2006-11-20-GlobalSymbols.cpp b/test/FrontendC++/2006-11-20-GlobalSymbols.cpp
new file mode 100644
index 0000000..fc896b3
--- /dev/null
+++ b/test/FrontendC++/2006-11-20-GlobalSymbols.cpp
@@ -0,0 +1,10 @@
+// PR1013
+// Check to make sure debug symbols use the correct name for globals and
+// functions. Will not assemble if it fails to.
+// RUN: %llvmgcc -O0 -g -c %s
+
+int foo __asm__("f\001oo");
+
+int bar() {
+ return foo;
+}
diff --git a/test/FrontendC++/2006-11-30-ConstantExprCrash.cpp b/test/FrontendC++/2006-11-30-ConstantExprCrash.cpp
new file mode 100644
index 0000000..365c8e8
--- /dev/null
+++ b/test/FrontendC++/2006-11-30-ConstantExprCrash.cpp
@@ -0,0 +1,27 @@
+// RUN: %llvmgxx %s -emit-llvm -S -o -
+// PR1027
+
+struct sys_var {
+ unsigned name_length;
+
+ bool no_support_one_shot;
+ sys_var() {}
+};
+
+
+struct sys_var_thd : public sys_var {
+};
+
+extern sys_var_thd sys_auto_is_null;
+
+sys_var *getsys_variables() {
+ return &sys_auto_is_null;
+}
+
+sys_var *sys_variables = &sys_auto_is_null;
+
+
+
+
+
+
diff --git a/test/FrontendC++/2006-11-30-NoCompileUnit.cpp b/test/FrontendC++/2006-11-30-NoCompileUnit.cpp
new file mode 100644
index 0000000..c1fa9ae
--- /dev/null
+++ b/test/FrontendC++/2006-11-30-NoCompileUnit.cpp
@@ -0,0 +1,58 @@
+// This is a regression test on debug info to make sure we don't hit a compile
+// unit size issue with gdb.
+// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \
+// RUN: llc --disable-fp-elim -o NoCompileUnit.s -f
+// RUN: %compile_c NoCompileUnit.s -o NoCompileUnit.o
+// RUN: %compile_cxx NoCompileUnit.o -o NoCompileUnit.exe
+// RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2
+// RUN: gdb -q -batch -n -x %t2 NoCompileUnit.exe | \
+// RUN: tee NoCompileUnit.out | not grep {"low == high"}
+// XFAIL: alpha|ia64|arm
+
+
+class MamaDebugTest {
+private:
+ int N;
+
+protected:
+ MamaDebugTest(int n) : N(n) {}
+
+ int getN() const { return N; }
+
+};
+
+class BabyDebugTest : public MamaDebugTest {
+private:
+
+public:
+ BabyDebugTest(int n) : MamaDebugTest(n) {}
+
+ static int doh;
+
+ int doit() {
+ int N = getN();
+ int Table[N];
+
+ int sum = 0;
+
+ for (int i = 0; i < N; ++i) {
+ int j = i;
+ Table[i] = j;
+ }
+ for (int i = 0; i < N; ++i) {
+ int j = Table[i];
+ sum += j;
+ }
+
+ return sum;
+ }
+
+};
+
+int BabyDebugTest::doh;
+
+
+int main(int argc, const char *argv[]) {
+ BabyDebugTest BDT(20);
+ return BDT.doit();
+}
diff --git a/test/FrontendC++/2006-11-30-Pubnames.cpp b/test/FrontendC++/2006-11-30-Pubnames.cpp
new file mode 100644
index 0000000..c6165a6
--- /dev/null
+++ b/test/FrontendC++/2006-11-30-Pubnames.cpp
@@ -0,0 +1,20 @@
+// This is a regression test on debug info to make sure that we can access
+// qualified global names.
+// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | \
+// RUN: llc --disable-fp-elim -o %t.s -f
+// RUN: %compile_c %t.s -o %t.o
+// RUN: %link %t.o -o %t.exe
+// RUN: echo {break main\nrun\np Pubnames::pubname} > %t.in
+// RUN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | grep {\$1 = 10}
+// XFAIL: alpha|ia64|arm
+
+struct Pubnames {
+ static int pubname;
+};
+
+int Pubnames::pubname = 10;
+
+int main (int argc, char** argv) {
+ Pubnames p;
+ return 0;
+}
diff --git a/test/FrontendC++/2007-01-02-UnboundedArray.cpp b/test/FrontendC++/2007-01-02-UnboundedArray.cpp
new file mode 100644
index 0000000..648d19b
--- /dev/null
+++ b/test/FrontendC++/2007-01-02-UnboundedArray.cpp
@@ -0,0 +1,14 @@
+// Make sure unbounded arrays compile with debug information.
+//
+// RUN: %llvmgcc -O0 -c -g %s
+
+// PR1068
+
+struct Object {
+ char buffer[];
+};
+
+int main(int argc, char** argv) {
+ new Object;
+ return 0;
+}
diff --git a/test/FrontendC++/2007-01-06-ELF-Thunk-Sections.cpp b/test/FrontendC++/2007-01-06-ELF-Thunk-Sections.cpp
new file mode 100644
index 0000000..654e11b
--- /dev/null
+++ b/test/FrontendC++/2007-01-06-ELF-Thunk-Sections.cpp
@@ -0,0 +1,49 @@
+// RUN: %llvmgxx %s -emit-llvm -S -o - | not grep gnu.linkonce.
+// PR1085
+
+class
+__attribute__((visibility("default"))) QGenericArgument
+{
+ public:inline QGenericArgument(const char *aName = 0, const void *aData = 0):_data(aData), _name(aName) {
+ }
+ private:const void *_data;
+ const char *_name;
+};
+struct __attribute__ ((
+ visibility("default"))) QMetaObject
+{
+ struct {
+ }
+ d;
+};
+class
+__attribute__((visibility("default"))) QObject
+{
+ virtual const QMetaObject *metaObject() const;
+};
+class
+__attribute__((visibility("default"))) QPaintDevice
+{
+ public:enum PaintDeviceMetric {
+ PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM, PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY, PdmPhysicalDpiX, PdmPhysicalDpiY
+ };
+ virtual ~ QPaintDevice();
+ union {
+ }
+ ct;
+};
+class
+__attribute__((visibility("default"))) QWidget:public QObject, public QPaintDevice
+{
+};
+class
+__attribute__((visibility("default"))) QDialog:public QWidget
+{
+};
+class TopicChooser:public QDialog {
+ virtual const QMetaObject *metaObject() const;
+};
+const QMetaObject *TopicChooser::
+metaObject() const
+{
+}
diff --git a/test/FrontendC++/2007-01-06-PtrMethodInit.cpp b/test/FrontendC++/2007-01-06-PtrMethodInit.cpp
new file mode 100644
index 0000000..f87c8d8
--- /dev/null
+++ b/test/FrontendC++/2007-01-06-PtrMethodInit.cpp
@@ -0,0 +1,75 @@
+// RUN: %llvmgxx %s -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/FrontendC++/2007-03-27-FunctionVarRename.cpp b/test/FrontendC++/2007-03-27-FunctionVarRename.cpp
new file mode 100644
index 0000000..538d6df
--- /dev/null
+++ b/test/FrontendC++/2007-03-27-FunctionVarRename.cpp
@@ -0,0 +1,17 @@
+// RUN: %llvmgxx %s -emit-llvm -S -o - | not grep eprintf1
+// RUN: %llvmgxx %s -emit-llvm -S -o - | grep eprintf
+
+// Only one eprintf should exist in the output
+
+extern "C"
+void __eprintf();
+
+void foo() {
+
+ __eprintf();
+}
+
+void *bar() {
+ extern void *__eprintf;
+ return &__eprintf;
+}
diff --git a/test/FrontendC++/2007-04-05-PackedBitFields-1.cpp b/test/FrontendC++/2007-04-05-PackedBitFields-1.cpp
new file mode 100644
index 0000000..4797baf
--- /dev/null
+++ b/test/FrontendC++/2007-04-05-PackedBitFields-1.cpp
@@ -0,0 +1,23 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+#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/FrontendC++/2007-04-05-PackedBitFieldsOverlap-2.cpp b/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap-2.cpp
new file mode 100644
index 0000000..3ba5d7b
--- /dev/null
+++ b/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap-2.cpp
@@ -0,0 +1,24 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+#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/FrontendC++/2007-04-05-PackedBitFieldsOverlap.cpp b/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap.cpp
new file mode 100644
index 0000000..ad272c9
--- /dev/null
+++ b/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap.cpp
@@ -0,0 +1,24 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+#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/FrontendC++/2007-04-05-PackedBitFieldsSmall.cpp b/test/FrontendC++/2007-04-05-PackedBitFieldsSmall.cpp
new file mode 100644
index 0000000..e7517dd
--- /dev/null
+++ b/test/FrontendC++/2007-04-05-PackedBitFieldsSmall.cpp
@@ -0,0 +1,27 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+
+#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/FrontendC++/2007-04-05-StructPackedFieldUnpacked.cpp b/test/FrontendC++/2007-04-05-StructPackedFieldUnpacked.cpp
new file mode 100644
index 0000000..52e2471
--- /dev/null
+++ b/test/FrontendC++/2007-04-05-StructPackedFieldUnpacked.cpp
@@ -0,0 +1,25 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null
+
+#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/FrontendC++/2007-04-10-PackedUnion.cpp b/test/FrontendC++/2007-04-10-PackedUnion.cpp
new file mode 100644
index 0000000..b4b8894
--- /dev/null
+++ b/test/FrontendC++/2007-04-10-PackedUnion.cpp
@@ -0,0 +1,41 @@
+// RUN: %llvmgxx -S %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/FrontendC++/2007-04-11-InlineStorageClassC++.cpp b/test/FrontendC++/2007-04-11-InlineStorageClassC++.cpp
new file mode 100644
index 0000000..eabcd57
--- /dev/null
+++ b/test/FrontendC++/2007-04-11-InlineStorageClassC++.cpp
@@ -0,0 +1,44 @@
+// RUN: %llvmgxx %s -S -emit-llvm -O0 -o - | grep define | \
+// RUN: grep xglobWeak | grep linkonce | count 1
+// RUN: %llvmgxx %s -S -emit-llvm -O0 -o - | grep define | \
+// RUN: grep xextWeak | grep linkonce | count 1
+// RUN: %llvmgxx %s -S -emit-llvm -O0 -o - | grep define | \
+// RUN: grep xWeaknoinline | grep weak | count 1
+// RUN: %llvmgxx %s -S -emit-llvm -O0 -o - | grep define | \
+// RUN: grep xWeakextnoinline | grep weak | count 1
+// RUN: %llvmgxx %s -S -emit-llvm -O0 -o - | grep define | \
+// RUN: grep xglobnoWeak | grep linkonce | count 1
+// RUN: %llvmgxx %s -S -emit-llvm -O0 -o - | grep define | \
+// RUN: grep xstatnoWeak | grep internal | count 1
+// RUN: %llvmgxx %s -S -emit-llvm -O0 -o - | grep define | \
+// RUN: grep xextnoWeak | grep linkonce | count 1
+inline int xglobWeak(int) __attribute__((weak));
+inline int xglobWeak (int i) {
+ return i*2;
+}
+inline int xextWeak(int) __attribute__((weak));
+extern inline int xextWeak (int i) {
+ return i*4;
+}
+int xWeaknoinline(int) __attribute__((weak));
+int xWeaknoinline(int i) {
+ return i*8;
+}
+int xWeakextnoinline(int) __attribute__((weak));
+extern int xWeakextnoinline(int i) {
+ return i*16;
+}
+inline int xglobnoWeak (int i) {
+ return i*32;
+}
+static inline int xstatnoWeak (int i) {
+ return i*64;
+}
+extern inline int xextnoWeak (int i) {
+ return i*128;
+}
+int j(int y) {
+ return xglobnoWeak(y)+xstatnoWeak(y)+xextnoWeak(y)+
+ xglobWeak(y)+xextWeak(y)+
+ xWeakextnoinline(y)+xWeaknoinline(y);
+}
diff --git a/test/FrontendC++/2007-04-14-FNoBuiltin.cpp b/test/FrontendC++/2007-04-14-FNoBuiltin.cpp
new file mode 100644
index 0000000..31e4528
--- /dev/null
+++ b/test/FrontendC++/2007-04-14-FNoBuiltin.cpp
@@ -0,0 +1,7 @@
+// RUN: %llvmgcc -S %s -O2 -fno-builtin -o - | grep call.*printf
+// Check that -fno-builtin is honored.
+
+extern "C" int printf(const char*, ...);
+void foo(const char *msg) {
+ printf("%s\n",msg);
+}
diff --git a/test/FrontendC++/2007-04-31-TryCatch.cpp b/test/FrontendC++/2007-04-31-TryCatch.cpp
new file mode 100644
index 0000000..8b8254d
--- /dev/null
+++ b/test/FrontendC++/2007-04-31-TryCatch.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o /dev/null
+
+#include <locale>
+
+namespace std
+{
+ codecvt<char, char, mbstate_t>::
+ codecvt(size_t __refs)
+ : __codecvt_abstract_base<char, char, mbstate_t>(__refs),
+ _M_c_locale_codecvt(_S_get_c_locale())
+ { }
+}
diff --git a/test/FrontendC++/2007-05-03-VectorInit.cpp b/test/FrontendC++/2007-05-03-VectorInit.cpp
new file mode 100644
index 0000000..b87f4d4
--- /dev/null
+++ b/test/FrontendC++/2007-05-03-VectorInit.cpp
@@ -0,0 +1,17 @@
+// RUN: %llvmgxx %s -S -emit-llvm -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/FrontendC++/2007-05-16-ReverseBitFieldCrash.cpp b/test/FrontendC++/2007-05-16-ReverseBitFieldCrash.cpp
new file mode 100644
index 0000000..8392c0b
--- /dev/null
+++ b/test/FrontendC++/2007-05-16-ReverseBitFieldCrash.cpp
@@ -0,0 +1,24 @@
+// RUN: %llvmgxx %s -emit-llvm -S -o -
+
+#pragma reverse_bitfields on
+typedef unsigned long UINT32;
+
+extern void abort(void);
+
+typedef struct TestStruct
+{
+ long first: 15,
+ second: 17;
+} TestStruct;
+
+int main (int argc, char * const argv[]) {
+
+ TestStruct testStruct = {1, 0};
+
+ UINT32 dw = *(UINT32 *)(&testStruct);
+
+ if(!(dw & 0xFFFF))
+ abort ();
+
+ return 0;
+}
diff --git a/test/FrontendC++/2007-05-23-TryFinally.cpp b/test/FrontendC++/2007-05-23-TryFinally.cpp
new file mode 100644
index 0000000..38f0b02
--- /dev/null
+++ b/test/FrontendC++/2007-05-23-TryFinally.cpp
@@ -0,0 +1,16 @@
+// RUN: %llvmgxx %s -S -emit-llvm -O2 -o - | ignore grep _Unwind_Resume | \
+// RUN: wc -l | grep {\[23\]}
+
+struct One { };
+struct Two { };
+
+void handle_unexpected () {
+ try
+ {
+ throw;
+ }
+ catch (One &)
+ {
+ throw Two ();
+ }
+}
diff --git a/test/FrontendC++/2007-07-04-NestedCatches.cpp b/test/FrontendC++/2007-07-04-NestedCatches.cpp
new file mode 100644
index 0000000..b10a5db
--- /dev/null
+++ b/test/FrontendC++/2007-07-04-NestedCatches.cpp
@@ -0,0 +1,32 @@
+// RUN: %llvmgxx %s -S -O2 -o - | \
+// RUN: ignore grep {eh\.selector.*One.*Two.*Three.*Four.*Five.*Six.*null} | \
+// RUN: wc -l | grep {\[01\]}
+
+extern void X(void);
+
+struct One {};
+struct Two {};
+struct Three {};
+struct Four {};
+struct Five {};
+struct Six {};
+
+static void A(void) throw ()
+{
+ X();
+}
+
+static void B(void) throw (Two)
+{
+ try { A(); } catch (One) {}
+}
+
+static void C(void) throw (Six, Five)
+{
+ try { B(); } catch (Three) {} catch (Four) {}
+}
+
+int main ()
+{
+ try { C(); } catch (...) {}
+}
diff --git a/test/FrontendC++/2007-07-29-RestrictPtrArg.cpp b/test/FrontendC++/2007-07-29-RestrictPtrArg.cpp
new file mode 100644
index 0000000..d54dfbe
--- /dev/null
+++ b/test/FrontendC++/2007-07-29-RestrictPtrArg.cpp
@@ -0,0 +1,6 @@
+// RUN: %llvmgxx -c -emit-llvm %s -o - | llvm-dis | grep noalias
+
+void foo(int * __restrict myptr1, int * myptr2) {
+ myptr1[0] = 0;
+ myptr2[0] = 0;
+}
diff --git a/test/FrontendC++/2007-07-29-RestrictRefArg.cpp b/test/FrontendC++/2007-07-29-RestrictRefArg.cpp
new file mode 100644
index 0000000..0c28e4d
--- /dev/null
+++ b/test/FrontendC++/2007-07-29-RestrictRefArg.cpp
@@ -0,0 +1,6 @@
+// RUN: %llvmgxx -c -emit-llvm %s -o - | llvm-dis | grep noalias
+
+void foo(int & __restrict myptr1, int & myptr2) {
+ myptr1 = 0;
+ myptr2 = 0;
+}
diff --git a/test/FrontendC++/2007-08-01-RestrictMethod.cpp b/test/FrontendC++/2007-08-01-RestrictMethod.cpp
new file mode 100644
index 0000000..b4922be
--- /dev/null
+++ b/test/FrontendC++/2007-08-01-RestrictMethod.cpp
@@ -0,0 +1,13 @@
+// RUN: %llvmgxx -c -emit-llvm %s -o - | llvm-dis | grep noalias
+
+
+class foo {
+ int member[4];
+
+ void bar(int * a);
+
+};
+
+void foo::bar(int * a) __restrict {
+ member[3] = *a;
+}
diff --git a/test/FrontendC++/2007-09-10-RecursiveTypeResolution.cpp b/test/FrontendC++/2007-09-10-RecursiveTypeResolution.cpp
new file mode 100644
index 0000000..f813944
--- /dev/null
+++ b/test/FrontendC++/2007-09-10-RecursiveTypeResolution.cpp
@@ -0,0 +1,88 @@
+// RUN: %llvmgxx -c -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);
+ }
+}
+
diff --git a/test/FrontendC++/2007-10-01-StructResize.cpp b/test/FrontendC++/2007-10-01-StructResize.cpp
new file mode 100644
index 0000000..d37057a
--- /dev/null
+++ b/test/FrontendC++/2007-10-01-StructResize.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -c %s -o /dev/null
+
+#pragma pack(4)
+
+struct Bork {
+ unsigned int f1 : 3;
+ unsigned int f2 : 30;
+};
+
+int Foo(Bork *hdr) {
+ hdr->f1 = 7;
+ hdr->f2 = 927;
+}
+
diff --git a/test/FrontendC++/2008-01-11-BadWarning.cpp b/test/FrontendC++/2008-01-11-BadWarning.cpp
new file mode 100644
index 0000000..43f6a71
--- /dev/null
+++ b/test/FrontendC++/2008-01-11-BadWarning.cpp
@@ -0,0 +1,6 @@
+// RUN: %llvmgcc -xc++ %s -S -o /dev/null |& not grep warning
+// rdar://5683899
+void** f(void **Buckets, unsigned NumBuckets) {
+ return Buckets + NumBuckets;
+}
+
diff --git a/test/FrontendC++/2008-01-12-VecInit.cpp b/test/FrontendC++/2008-01-12-VecInit.cpp
new file mode 100644
index 0000000..e21bbb9
--- /dev/null
+++ b/test/FrontendC++/2008-01-12-VecInit.cpp
@@ -0,0 +1,6 @@
+// RUN: %llvmgcc -xc++ %s -S -o -
+// rdar://5685492
+
+typedef int __attribute__((vector_size(16))) v;
+v vt = {1, 2, 3, 4};
+
diff --git a/test/FrontendC++/2008-02-13-sret.cpp b/test/FrontendC++/2008-02-13-sret.cpp
new file mode 100644
index 0000000..15bfa2d
--- /dev/null
+++ b/test/FrontendC++/2008-02-13-sret.cpp
@@ -0,0 +1,41 @@
+// RUN: %llvmgxx -S -O1 -m32 -emit-llvm %s -o - | grep {store i32} | count 1
+
+// Test that all 8 bytes of ret in check242 are copied, and only 4 bytes of
+// ret in check93 are copied (the same LLVM struct is used for both).
+
+typedef __builtin_va_list va_list;
+typedef unsigned long size_t;
+void *memset(void *, int, size_t);
+
+struct S93 { __attribute__((aligned (8))) void * a; } ;
+ extern struct S93 s93;
+ struct S93 check93 () {
+ struct S93 ret;
+ memset (&ret, 0, sizeof (ret));
+ ret.a = s93.a;
+ return ret; }
+
+struct S242 { char * a;int b[1]; } ;
+ extern struct S242 s242;
+
+ struct S242 check242 () {
+ struct S242 ret;
+ memset (&ret, 0, sizeof (ret));
+ ret.a = s242.a;
+ ret.b[0] = s242.b[0];
+ return ret; }
+
+void check93va (int z, ...) {
+ struct S93 arg;
+ va_list ap;
+ __builtin_va_start(ap,z);
+ arg = __builtin_va_arg(ap,struct S93);
+ __builtin_va_end(ap); }
+
+void check242va (int z, ...) {
+struct S242 arg;
+va_list ap;
+__builtin_va_start(ap,z);
+ arg = __builtin_va_arg(ap,struct S242);
+ __builtin_va_end(ap); }
+
diff --git a/test/FrontendC++/2008-05-07-CrazyOffsetOf.cpp b/test/FrontendC++/2008-05-07-CrazyOffsetOf.cpp
new file mode 100644
index 0000000..f183197
--- /dev/null
+++ b/test/FrontendC++/2008-05-07-CrazyOffsetOf.cpp
@@ -0,0 +1,8 @@
+// RUN: %llvmgxx -S %s -o -
+// rdar://5914926
+
+struct bork {
+ struct bork *next_local;
+ char * query;
+};
+int offset = (char *) &(((struct bork *) 0x10)->query) - (char *) 0x10;
diff --git a/test/FrontendC++/dg.exp b/test/FrontendC++/dg.exp
new file mode 100644
index 0000000..fc852e3
--- /dev/null
+++ b/test/FrontendC++/dg.exp
@@ -0,0 +1,5 @@
+load_lib llvm.exp
+
+if [ llvm_gcc_supports c++ ] then {
+ RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+}
diff --git a/test/FrontendC++/ptr-to-method-devirt.cpp b/test/FrontendC++/ptr-to-method-devirt.cpp
new file mode 100644
index 0000000..358b801
--- /dev/null
+++ b/test/FrontendC++/ptr-to-method-devirt.cpp
@@ -0,0 +1,14 @@
+// PR1602
+// RUN: %llvmgxx -c -emit-llvm %s -o - -O3 | llvm-dis | not grep ptrtoint
+// RUN: %llvmgxx -c -emit-llvm %s -o - -O3 | llvm-dis | grep getelementptr | count 1
+
+
+struct S { virtual void f(); };
+
+typedef void (S::*P)(void);
+
+const P p = &S::f;
+
+void g(S s) {
+ (s.*p)();
+ }