summaryrefslogtreecommitdiffstats
path: root/test/FrontendC++
diff options
context:
space:
mode:
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-18-EnumArray.cpp14
-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.cpp12
-rw-r--r--test/FrontendC++/2006-10-30-ClassBitfield.cpp16
-rw-r--r--test/FrontendC++/2006-11-06-StackTrace.cpp38
-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.cpp60
-rw-r--r--test/FrontendC++/2006-11-30-Pubnames.cpp22
-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-05-07-CrazyOffsetOf.cpp8
-rw-r--r--test/FrontendC++/2008-10-29-WrongOffset.cpp489
-rw-r--r--test/FrontendC++/2009-02-07-VolatileArrayRefHack.cpp7
-rw-r--r--test/FrontendC++/2009-02-16-CtorNames-dbg.cpp10
-rw-r--r--test/FrontendC++/2009-03-17-dbg.cpp16
-rw-r--r--test/FrontendC++/2009-04-21-DtorNames-dbg.cpp32
-rw-r--r--test/FrontendC++/2009-04-23-bool2.cpp15
-rw-r--r--test/FrontendC++/2009-05-04-PureConstNounwind.cpp8
-rw-r--r--test/FrontendC++/2009-06-16-DebugInfoCrash.cpp10
-rw-r--r--test/FrontendC++/2009-06-20-DarwinPPCLayout.cpp32
-rw-r--r--test/FrontendC++/2009-06-30-ByrefBlock.cpp11
-rw-r--r--test/FrontendC++/2009-07-15-LineNumbers.cpp27
-rw-r--r--test/FrontendC++/2009-07-16-PrivateCopyConstructor.cpp15
-rw-r--r--test/FrontendC++/2009-07-16-Using.cpp8
-rw-r--r--test/FrontendC++/2009-08-05-ZeroInitWidth.cpp12
-rw-r--r--test/FrontendC++/2009-08-11-VectorRetTy.cpp13
-rw-r--r--test/FrontendC++/2009-09-04-modify-crash.cpp7
-rw-r--r--test/FrontendC++/2009-09-09-packed-layout.cpp18
-rw-r--r--test/FrontendC++/2009-10-27-crash.cpp43
-rw-r--r--test/FrontendC++/2009-12-23-MissingSext.cpp16
-rw-r--r--test/FrontendC++/2010-02-08-NamespaceVar.cpp16
-rw-r--r--test/FrontendC++/alignstack.cpp23
-rw-r--r--test/FrontendC++/dg.exp5
-rw-r--r--test/FrontendC++/integration-O2.cpp19
-rw-r--r--test/FrontendC++/m64-ptr.cpp19
-rw-r--r--test/FrontendC++/member-alignment.cpp20
-rw-r--r--test/FrontendC++/ptr-to-method-devirt.cpp14
-rw-r--r--test/FrontendC++/varargs.cpp19
-rw-r--r--test/FrontendC++/weak-external.cpp17
-rw-r--r--test/FrontendC++/x86-64-abi-sret-vs-2word-struct-param.cpp27
112 files changed, 2535 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..f071c3c
--- /dev/null
+++ b/test/FrontendC++/2003-08-20-ExceptionFail.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..5dbfa33
--- /dev/null
+++ b/test/FrontendC++/2003-08-21-EmptyClass.cpp
@@ -0,0 +1,9 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..dec9718
--- /dev/null
+++ b/test/FrontendC++/2003-08-27-TypeNamespaces.cpp
@@ -0,0 +1,16 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..9330e94
--- /dev/null
+++ b/test/FrontendC++/2003-08-28-ForwardType.cpp
@@ -0,0 +1,23 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..98c5f5d
--- /dev/null
+++ b/test/FrontendC++/2003-08-28-SaveExprBug.cpp
@@ -0,0 +1,24 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..a45ad03
--- /dev/null
+++ b/test/FrontendC++/2003-08-31-StructLayout.cpp
@@ -0,0 +1,16 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..3bd707e
--- /dev/null
+++ b/test/FrontendC++/2003-09-22-CompositeExprValue.cpp
@@ -0,0 +1,11 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..72997c5
--- /dev/null
+++ b/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp
@@ -0,0 +1,17 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..365795d
--- /dev/null
+++ b/test/FrontendC++/2003-09-30-CommaExprBug.cpp
@@ -0,0 +1,10 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..63f62f2
--- /dev/null
+++ b/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp
@@ -0,0 +1,10 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..a1eee71
--- /dev/null
+++ b/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..94c1199
--- /dev/null
+++ b/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..103945d
--- /dev/null
+++ b/test/FrontendC++/2003-10-17-BoolBitfields.cpp
@@ -0,0 +1,11 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..abda017
--- /dev/null
+++ b/test/FrontendC++/2003-10-27-VirtualBaseClassCrash.cpp
@@ -0,0 +1,17 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..4ab3398
--- /dev/null
+++ b/test/FrontendC++/2003-11-04-ArrayConstructors.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..7dbe788
--- /dev/null
+++ b/test/FrontendC++/2003-11-04-CatchLabelName.cpp
@@ -0,0 +1,11 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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-18-EnumArray.cpp b/test/FrontendC++/2003-11-18-EnumArray.cpp
new file mode 100644
index 0000000..bb1b3bf
--- /dev/null
+++ b/test/FrontendC++/2003-11-18-EnumArray.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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-PtrMemConstantInitializer.cpp b/test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp
new file mode 100644
index 0000000..72609e7
--- /dev/null
+++ b/test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..5ea0a2c
--- /dev/null
+++ b/test/FrontendC++/2003-11-25-ReturningOpaqueByValue.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..99cfc8d
--- /dev/null
+++ b/test/FrontendC++/2003-11-27-MultipleInheritanceThunk.cpp
@@ -0,0 +1,28 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..8df95cb
--- /dev/null
+++ b/test/FrontendC++/2003-11-29-DuplicatedCleanupTest.cpp
@@ -0,0 +1,41 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..b87e786
--- /dev/null
+++ b/test/FrontendC++/2003-12-08-ArrayOfPtrToMemberFunc.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..35880ab
--- /dev/null
+++ b/test/FrontendC++/2004-03-08-ReinterpretCastCopy.cpp
@@ -0,0 +1,21 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..c2e52f6
--- /dev/null
+++ b/test/FrontendC++/2004-03-15-CleanupsAndGotos.cpp
@@ -0,0 +1,14 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..4ad4c7d
--- /dev/null
+++ b/test/FrontendC++/2004-06-08-LateTemplateInstantiation.cpp
@@ -0,0 +1,19 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..f52baaf
--- /dev/null
+++ b/test/FrontendC++/2004-09-27-CompilerCrash.cpp
@@ -0,0 +1,13 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..87ababc
--- /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 U_t {
+ 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..cb09bd0
--- /dev/null
+++ b/test/FrontendC++/2006-09-27-Debug-Protection.cpp
@@ -0,0 +1,12 @@
+// 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..b79c0bf
--- /dev/null
+++ b/test/FrontendC++/2006-11-06-StackTrace.cpp
@@ -0,0 +1,38 @@
+// 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 - | \
+// RUN: llc --disable-fp-elim -o %t.s -O0 -relocation-model=pic
+// 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
+// RN: gdb -q -batch -n -x %t.in %t.exe | tee %t.out | \
+// RN: grep {#0 DeepStack::deepest.*(this=.*,.*x=33)}
+// RN: gdb -q -batch -n -x %t.in %t.exe | \
+// RN: grep {#7 0x.* in main.*(argc=\[12\],.*argv=.*)}
+
+// Only works on ppc (but not apple-darwin9), x86 and x86_64. Should
+// generalize?
+// XAIL: alpha,arm,powerpc-apple-darwin9
+
+#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..242a37e
--- /dev/null
+++ b/test/FrontendC++/2006-11-30-NoCompileUnit.cpp
@@ -0,0 +1,60 @@
+// 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 - | \
+// RUN: llc --disable-fp-elim -o NoCompileUnit.s
+// RUN: %compile_c NoCompileUnit.s -o NoCompileUnit.o
+// RUN: %link 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,arm
+// XFAIL: *
+// See PR2454
+
+
+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..239d3f5
--- /dev/null
+++ b/test/FrontendC++/2006-11-30-Pubnames.cpp
@@ -0,0 +1,22 @@
+// 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 - | \
+// RUN: llc --disable-fp-elim -o %t.s -O0
+// RUN: %compile_c %t.s -o %t.o
+// RUN: %link %t.o -o %t.exe
+// RUN: %llvmdsymutil %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,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..174dddf
--- /dev/null
+++ b/test/FrontendC++/2007-04-05-PackedBitFields-1.cpp
@@ -0,0 +1,23 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..55da1a6
--- /dev/null
+++ b/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap-2.cpp
@@ -0,0 +1,24 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..46a8949
--- /dev/null
+++ b/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap.cpp
@@ -0,0 +1,24 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..7377b82
--- /dev/null
+++ b/test/FrontendC++/2007-04-05-PackedBitFieldsSmall.cpp
@@ -0,0 +1,27 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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..b550b5f
--- /dev/null
+++ b/test/FrontendC++/2007-04-05-StructPackedFieldUnpacked.cpp
@@ -0,0 +1,25 @@
+// RUN: %llvmgxx -S %s -o - | llvm-as -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-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++/2008-10-29-WrongOffset.cpp b/test/FrontendC++/2008-10-29-WrongOffset.cpp
new file mode 100644
index 0000000..1b3be21
--- /dev/null
+++ b/test/FrontendC++/2008-10-29-WrongOffset.cpp
@@ -0,0 +1,489 @@
+// RUN: %llvmgxx %s -c -o /dev/null
+// PR2917
+
+#include <complex>
+template < int Dim, class T, class EngineTag > class Engine;
+template < class Subject, class Sub1, bool SV > struct View1Implementation;
+template < class LayoutTag, class PatchTag > struct MultiPatch;
+template < class LayoutTag, class PatchTag, int Dim2 > struct MultiPatchView;
+template < class Engine, class SubDomain > struct NewEngine
+{
+};
+template < class T > class DomainTraits;
+template < class DomT, class T, int Dim > struct DomainTraitsDomain
+{
+ typedef DomT NewDomain1_t;
+};
+template < int Dim > class Interval;
+template < int Dim > class Loc;
+template < class DT > class DomainBase
+{
+};
+
+template < int Dim, class DT > class Domain:public DomainBase < DT >
+{
+};
+template < int Dim > struct DomainTraits <Interval < Dim >
+ >:public DomainTraitsDomain < Interval < Dim >, int, Dim >
+{
+ enum
+ {
+ singleValued = false
+ };
+};
+template < class T1 > struct NewDomain1
+{
+ typedef typename DomainTraits < T1 >::NewDomain1_t SliceType_t;
+};
+template < class Domain, class Sub > struct TemporaryNewDomain1
+{
+ typedef typename NewDomain1 < Sub >::SliceType_t SliceType_t;
+};
+template < int Dim > class Interval:public Domain < Dim,
+ DomainTraits < Interval < Dim > > >
+{
+};
+template < int Dim > class GuardLayers
+{
+};
+template < class T > class Observer
+{
+};
+
+template < class T > class Observable
+{
+private:T & observed_m;
+ int count_m;
+};
+
+class RefCounted
+{
+};
+template < class T > class RefCountedPtr
+{
+public:typedef RefCountedPtr < T > This_t;
+ RefCountedPtr (T * const pT):ptr_m (pT)
+ {
+ }
+ inline T *operator-> () const
+ {
+ }
+ T *ptr_m;
+};
+
+template < class Dom, class T > class DomainMap
+{
+};
+
+template < class LayoutTag, int Dim > struct MultiPatchLayoutTraits
+{
+};
+template < int Dim > class LayoutBaseData
+{
+public:typedef Interval < Dim > Domain_t;
+ Domain_t domain_m;
+};
+template < int Dim, class LBD > class LayoutBase
+{
+public:typedef LayoutBaseData < Dim > LayoutData_t;
+ typedef typename LayoutData_t::Domain_t Domain_t;
+ typedef GuardLayers < Dim > GuardLayers_t;
+ inline const Domain_t & domain () const
+ {
+ return pdata_m->domain_m;
+ }
+ inline const Domain_t & innerDomain () const
+ {
+ }
+ inline GuardLayers_t externalGuards () const
+ {
+ }
+ RefCountedPtr < LBD > pdata_m;
+};
+template < class Tag > struct Remote;
+struct Brick
+{
+};
+template < class Thing, class Sub > struct View1
+{
+};
+template < int Dim, class T, class LayoutTag,
+ class PatchTag > struct NewEngine <Engine < Dim, T, MultiPatch < LayoutTag,
+ PatchTag > >, Interval < Dim > >
+{
+ typedef Engine < Dim, T, MultiPatchView < LayoutTag, PatchTag,
+ Dim > >Type_t;
+};
+template < int Dim, class T, class LayoutTag, class PatchTag,
+ int Dim2 > struct NewEngine <Engine < Dim, T, MultiPatchView < LayoutTag,
+ PatchTag, Dim2 > >, Interval < Dim > >
+{
+ typedef Engine < Dim, T, MultiPatchView < LayoutTag, PatchTag,
+ Dim2 > >Type_t;
+};
+template < int Dim, class T, class LayoutTag,
+ class PatchTag > class Engine < Dim, T, MultiPatch < LayoutTag,
+ PatchTag > >:public Observer < typename MultiPatchLayoutTraits < LayoutTag,
+ Dim >::Layout_t >
+{
+public:typedef MultiPatch < LayoutTag, PatchTag > Tag_t;
+ typedef Interval < Dim > Domain_t;
+};
+template < int Dim, class T, class LayoutTag, class PatchTag,
+ int Dim2 > class Engine < Dim, T, MultiPatchView < LayoutTag, PatchTag,
+ Dim2 > >
+{
+public:typedef MultiPatchView < LayoutTag, PatchTag, Dim2 > Tag_t;
+ typedef Interval < Dim > Domain_t;
+ typedef T Element_t;
+ enum
+ {
+ dimensions = Dim
+ };
+};
+class Full;
+template < int Dim, class T = double, class EngineTag = Full > class Vector {
+};
+
+template < int Dim > inline Interval < Dim >
+shrinkRight (const Interval < Dim > &dom, int s)
+{
+}
+
+template < int Dim > class GridLayout;
+struct GridTag
+{
+};
+template < int Dim > struct MultiPatchLayoutTraits <GridTag, Dim >
+{
+ typedef GridLayout < Dim > Layout_t;
+};
+template < int Dim > class GridLayoutData:public LayoutBaseData < Dim >,
+ public RefCounted, public Observable < GridLayoutData < Dim > >
+{
+ typedef int AxisIndex_t;
+ mutable DomainMap < Interval < 1 >, AxisIndex_t > mapAloc_m[Dim];
+};
+template < int Dim > class GridLayout:public LayoutBase < Dim,
+ GridLayoutData < Dim > >, public Observable < GridLayout < Dim > >,
+ public Observer < GridLayoutData < Dim > >
+{
+public:typedef GridLayout < Dim > This_t;
+ GridLayout ();
+};
+template < class MeshTag, class T, class EngineTag > class Field;
+enum CenteringType
+{
+ VertexType, EdgeType, FaceType, CellType
+};
+enum ContinuityType
+{
+ Continuous = 0, Discontinuous
+};
+template < int Dim > class Centering
+{
+public:typedef Loc < Dim > Orientation;
+ inline int size () const
+ {
+ }
+};
+template < int Dim > const Centering < Dim >
+canonicalCentering (const enum CenteringType type,
+ const enum ContinuityType discontinuous,
+ const int dimension = 0);
+template < class Mesh, class T, class EngineTag > class FieldEngine
+{
+public:enum
+ {
+ dimensions = Mesh::dimensions
+ };
+ enum
+ {
+ Dim = dimensions
+ };
+ typedef Engine < Dim, T, EngineTag > Engine_t;
+ typedef typename Engine_t::Domain_t Domain_t;
+ typedef GuardLayers < Dim > GuardLayers_t;
+template < class Layout2 > FieldEngine (const Centering < Dim > &centering, const Layout2 & layout, const Mesh & mesh, int materials = 1):num_materials_m (materials), centering_m (centering),
+ stride_m (centering.size ()), physicalCellDomain_m (layout.domain ()),
+ guards_m (layout.externalGuards ()), mesh_m (mesh)
+ {
+ }
+ unsigned int num_materials_m;
+ Centering < Dim > centering_m;
+ int stride_m;
+ Domain_t physicalCellDomain_m;
+ GuardLayers_t guards_m;
+ Mesh mesh_m;
+};
+
+template < class Subject > class SubFieldView;
+template < class Mesh, class T,
+ class EngineTag > class SubFieldView < Field < Mesh, T, EngineTag > >
+{
+public:typedef Field < Mesh, T, EngineTag > Type_t;
+};
+
+template < int Dim, class Mesh, class Domain > struct NewMeshTag
+{
+ typedef Mesh Type_t;
+};
+template < class Mesh, class T, class EngineTag,
+ class Domain > struct View1Implementation <Field < Mesh, T, EngineTag >,
+ Domain, false >
+{
+ typedef Field < Mesh, T, EngineTag > Subject_t;
+ typedef typename Subject_t::Engine_t Engine_t;
+ typedef typename NewEngine < Engine_t, Domain >::Type_t NewEngine_t;
+ typedef typename NewEngine_t::Element_t NewT_t;
+ typedef typename NewEngine_t::Tag_t NewEngineTag_t;
+ typedef typename NewMeshTag < NewEngine_t::dimensions, Mesh,
+ Domain >::Type_t NewMeshTag_t;
+ typedef Field < NewMeshTag_t, NewT_t, NewEngineTag_t > Type_t;
+};
+template < class Mesh, class T, class EngineTag,
+ class Sub1 > struct View1 <Field < Mesh, T, EngineTag >, Sub1 >
+{
+ typedef Field < Mesh, T, EngineTag > Subject_t;
+ typedef typename Subject_t::Domain_t Domain_t;
+ typedef TemporaryNewDomain1 < Domain_t, Sub1 > NewDomain_t;
+ typedef typename NewDomain_t::SliceType_t SDomain_t;
+ enum
+ {
+ sv = DomainTraits < SDomain_t >::singleValued
+ };
+ typedef View1Implementation < Subject_t, SDomain_t, sv > Dispatch_t;
+ typedef typename Dispatch_t::Type_t Type_t;
+};
+template < class Mesh, class T = double, class EngineTag = Brick > class Field {
+public:typedef Mesh MeshTag_t;
+ typedef Mesh Mesh_t;
+ typedef Field < Mesh, T, EngineTag > This_t;
+ typedef FieldEngine < Mesh, T, EngineTag > FieldEngine_t;
+ enum
+ {
+ dimensions = FieldEngine_t::dimensions
+ };
+ typedef Engine < dimensions, T, EngineTag > Engine_t;
+ typedef typename Engine_t::Domain_t Domain_t;
+ typedef Centering < dimensions > Centering_t;
+ template < class Layout2 > Field (const Centering_t & centering,
+ const Layout2 & layout,
+ const Mesh_t &
+ mesh):fieldEngine_m (centering, layout,
+ mesh)
+ {
+ }
+ inline typename SubFieldView < This_t >::Type_t center (int c) const
+ {
+ }
+ inline typename View1 < This_t, Domain_t >::Type_t all () const
+ {
+ }
+ template < class T1 > const This_t & operator= (const T1 & rhs) const
+ {
+ }
+private: FieldEngine_t fieldEngine_m;
+};
+
+struct UniformRectilinearTag
+{
+};
+struct CartesianTag
+{
+};
+template < class MeshTraits > struct CartesianURM;
+template < class MeshTraits > class UniformRectilinearMeshData;
+template < class MeshTraits > class UniformRectilinearMesh;
+template < int Dim, typename T = double, class MeshTag =
+ UniformRectilinearTag, class CoordinateSystemTag = CartesianTag, int CDim =
+ Dim > struct MeshTraits;
+template < int Dim, typename T, class MeshTag, class CoordinateSystemTag,
+ int CDim > struct MeshTraitsBase
+{
+ typedef MeshTraits < Dim, T, MeshTag, CoordinateSystemTag,
+ CDim > MeshTraits_t;
+ enum
+ {
+ dimensions = Dim
+ };
+ typedef Vector < CDim, T > PointType_t;
+};
+template < int Dim, typename T, int CDim > struct MeshTraits <Dim, T,
+ UniformRectilinearTag, CartesianTag, CDim >:public MeshTraitsBase < Dim, T,
+ UniformRectilinearTag, CartesianTag, CDim >
+{
+ typedef typename MeshTraitsBase < Dim, T, UniformRectilinearTag,
+ CartesianTag, CDim >::MeshTraits_t MeshTraits_t;
+ typedef CartesianURM < MeshTraits_t > CoordinateSystem_t;
+ typedef UniformRectilinearMeshData < MeshTraits_t > MeshData_t;
+ typedef UniformRectilinearMesh < MeshTraits_t > Mesh_t;
+ typedef Vector < CDim, T > SpacingsType_t;
+};
+template < int Dim > class NoMeshData:public RefCounted
+{
+public:NoMeshData ()
+ {
+ }
+ template < class Layout >
+ explicit NoMeshData (const Layout &
+ layout):physicalVertexDomain_m (layout.
+ innerDomain ()),
+ physicalCellDomain_m (shrinkRight (physicalVertexDomain_m, 1)),
+ totalVertexDomain_m (layout.domain ()),
+ totalCellDomain_m (shrinkRight (totalVertexDomain_m, 1))
+ {
+ }
+private:Interval < Dim > physicalVertexDomain_m, physicalCellDomain_m;
+ Interval < Dim > totalVertexDomain_m, totalCellDomain_m;
+};
+
+template < class MeshTraits > class UniformRectilinearMeshData:public NoMeshData <
+ MeshTraits::
+ dimensions >
+{
+public:typedef typename
+ MeshTraits::MeshData_t
+ MeshData_t;
+ typedef typename
+ MeshTraits::PointType_t
+ PointType_t;
+ typedef typename
+ MeshTraits::SpacingsType_t
+ SpacingsType_t;
+ enum
+ {
+ dimensions = MeshTraits::dimensions
+ };
+ template < class Layout > UniformRectilinearMeshData (const Layout & layout,
+ const PointType_t &
+ origin,
+ const SpacingsType_t &
+ spacings):
+ NoMeshData <
+ dimensions > (layout),
+ origin_m (origin),
+ spacings_m (spacings)
+ {
+ }
+private:PointType_t origin_m;
+ SpacingsType_t
+ spacings_m;
+};
+
+template < class MeshTraits > class UniformRectilinearMesh:public MeshTraits::
+ CoordinateSystem_t
+{
+public:typedef MeshTraits
+ MeshTraits_t;
+ typedef typename
+ MeshTraits::MeshData_t
+ MeshData_t;
+ typedef typename
+ MeshTraits::PointType_t
+ PointType_t;
+ typedef typename
+ MeshTraits::SpacingsType_t
+ SpacingsType_t;
+ enum
+ {
+ dimensions = MeshTraits::dimensions
+ };
+ template < class Layout >
+ inline UniformRectilinearMesh (const Layout & layout,
+ const PointType_t & origin,
+ const SpacingsType_t & spacings):
+ data_m (new MeshData_t (layout, origin, spacings))
+ {
+ }
+private:RefCountedPtr < MeshData_t > data_m;
+};
+
+template < class MeshTraits > struct GenericURM
+{
+};
+template < class MeshTraits > struct CartesianURM:
+ public
+ GenericURM <
+ MeshTraits >
+{
+};
+template < int
+ dim,
+ class
+ MeshTag = UniformRectilinearTag, class CoordinateSystemTag = CartesianTag > struct ParallelTraits {
+ enum
+ {
+ Dim = dim
+ };
+ typedef
+ GridLayout <
+ dim >
+ Layout_t;
+ typedef
+ MeshTraits <
+ dim, double,
+ MeshTag,
+ CoordinateSystemTag >
+ MeshTraits_t;
+ typedef typename
+ MeshTraits_t::Mesh_t
+ Mesh_t;
+ typedef
+ MultiPatch <
+ GridTag,
+ Remote <
+ Brick > >
+ Engine_t;
+};
+template < class ComputeTraits > struct RhalkTraits:
+ public
+ ComputeTraits
+{
+ typedef typename
+ ComputeTraits::Mesh_t
+ Mesh_t;
+ typedef typename
+ ComputeTraits::Engine_t
+ Engine_t;
+ enum
+ {
+ Dim = ComputeTraits::Dim
+ };
+ typedef
+ Centering <
+ Dim >
+ Centering_t;
+ typedef typename
+ Mesh_t::SpacingsType_t
+ Spacings_t;
+ typedef
+ Field <
+ Mesh_t, double,
+ Engine_t >
+ Scalar_t;
+};
+enum
+{
+ Dim = 3
+};
+typedef
+ RhalkTraits <
+ ParallelTraits <
+ Dim,
+ UniformRectilinearTag,
+CartesianTag > >
+ Traits_t;
+Vector < Dim > origin;
+Traits_t::Spacings_t spacings;
+int
+main (int argc, char **argv)
+{
+ Traits_t::Layout_t layout;
+ Traits_t::Mesh_t mesh (layout, origin, spacings);
+ Traits_t::Centering_t face =
+ canonicalCentering < Traits_t::Dim > (FaceType, Continuous);
+ Traits_t::Scalar_t v (face, layout, mesh);
+ for (int i = 0; i < Dim; ++i)
+ v.center (i).all () = std::numeric_limits < double >::signaling_NaN ();
+}
diff --git a/test/FrontendC++/2009-02-07-VolatileArrayRefHack.cpp b/test/FrontendC++/2009-02-07-VolatileArrayRefHack.cpp
new file mode 100644
index 0000000..b8589b0
--- /dev/null
+++ b/test/FrontendC++/2009-02-07-VolatileArrayRefHack.cpp
@@ -0,0 +1,7 @@
+// RUN: %llvmgxx -S %s -o - | grep {volatile load}
+// PR3320
+
+void test(volatile int *a) {
+ // should be a volatile load.
+ a[0];
+}
diff --git a/test/FrontendC++/2009-02-16-CtorNames-dbg.cpp b/test/FrontendC++/2009-02-16-CtorNames-dbg.cpp
new file mode 100644
index 0000000..8f1b598
--- /dev/null
+++ b/test/FrontendC++/2009-02-16-CtorNames-dbg.cpp
@@ -0,0 +1,10 @@
+// RUN: %llvmgcc -S -g --emit-llvm %s -o - | grep "\~A"
+class A {
+ int i;
+public:
+ A() { i = 0; }
+ ~A() { i = 42; }
+};
+
+A a;
+
diff --git a/test/FrontendC++/2009-03-17-dbg.cpp b/test/FrontendC++/2009-03-17-dbg.cpp
new file mode 100644
index 0000000..93da618
--- /dev/null
+++ b/test/FrontendC++/2009-03-17-dbg.cpp
@@ -0,0 +1,16 @@
+// RUN: %llvmgxx -c -emit-llvm %s -o /dev/null -g
+// XTARGET: darwin,linux
+// XFAIL: *
+template <typename T1,typename T2>
+inline void f(const T1&,const T2&) { }
+
+template <typename T1,typename T2,void F(const T1&,const T2&)>
+struct A {
+ template <typename T> void g(T& i) { }
+};
+
+int main() {
+ int i;
+ A<int,int,f> a;
+ a.g(i);
+}
diff --git a/test/FrontendC++/2009-04-21-DtorNames-dbg.cpp b/test/FrontendC++/2009-04-21-DtorNames-dbg.cpp
new file mode 100644
index 0000000..997c3f7
--- /dev/null
+++ b/test/FrontendC++/2009-04-21-DtorNames-dbg.cpp
@@ -0,0 +1,32 @@
+// RUN: %llvmgcc -c -g %s -o - | llc -O0 -o %t.s
+// RUN: %compile_c %t.s -o %t.o
+// PR4025
+
+template <typename _Tp> class vector
+{
+public:
+ ~vector ()
+ {
+ }
+};
+
+class Foo
+{
+ ~Foo();
+ class FooImpl *impl_;
+};
+
+namespace {
+ class Bar;
+}
+
+class FooImpl
+{
+ vector<Bar*> thing;
+};
+
+Foo::~Foo()
+{
+ delete impl_;
+}
+
diff --git a/test/FrontendC++/2009-04-23-bool2.cpp b/test/FrontendC++/2009-04-23-bool2.cpp
new file mode 100644
index 0000000..8614a37
--- /dev/null
+++ b/test/FrontendC++/2009-04-23-bool2.cpp
@@ -0,0 +1,15 @@
+// RUN: %llvmgxx -c -emit-llvm %s -o /dev/null
+// g++.old-deja/g++.jason/bool2.C from gcc testsuite.
+// Crashed before 67975 went in.
+struct F {
+ bool b1 : 1;
+ bool b2 : 7;
+};
+
+int main()
+{
+ F f = { true, true };
+
+ if (int (f.b1) != 1)
+ return 1;
+}
diff --git a/test/FrontendC++/2009-05-04-PureConstNounwind.cpp b/test/FrontendC++/2009-05-04-PureConstNounwind.cpp
new file mode 100644
index 0000000..a4b4653
--- /dev/null
+++ b/test/FrontendC++/2009-05-04-PureConstNounwind.cpp
@@ -0,0 +1,8 @@
+// RUN: %llvmgxx -S -emit-llvm %s -o - | grep nounwind | count 4
+int c(void) __attribute__((const));
+int p(void) __attribute__((pure));
+int t(void);
+
+int f(void) {
+ return c() + p() + t();
+}
diff --git a/test/FrontendC++/2009-06-16-DebugInfoCrash.cpp b/test/FrontendC++/2009-06-16-DebugInfoCrash.cpp
new file mode 100644
index 0000000..b3758d2
--- /dev/null
+++ b/test/FrontendC++/2009-06-16-DebugInfoCrash.cpp
@@ -0,0 +1,10 @@
+// RUN: %llvmgxx -c -emit-llvm %s -o /dev/null -g
+// This crashes if we try to emit debug info for TEMPLATE_DECL members.
+template <class T> class K2PtrVectorBase {};
+template <class T> class K2Vector {};
+template <class U > class K2Vector<U*> : public K2PtrVectorBase<U*> {};
+class ScriptInfoManager {
+ void PostRegister() ;
+ template <class SI> short ReplaceExistingElement(K2Vector<SI*>& v);
+};
+void ScriptInfoManager::PostRegister() {}
diff --git a/test/FrontendC++/2009-06-20-DarwinPPCLayout.cpp b/test/FrontendC++/2009-06-20-DarwinPPCLayout.cpp
new file mode 100644
index 0000000..dcb2f16
--- /dev/null
+++ b/test/FrontendC++/2009-06-20-DarwinPPCLayout.cpp
@@ -0,0 +1,32 @@
+// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep baz | grep global | grep {struct.bar}
+// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep ccc | grep global | grep {struct.CC}
+// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep quux | grep global | grep {struct.bar}
+// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep foo | grep global | grep {struct.SRCFilter::FilterEntry}
+// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep {struct.bar} | grep {1 x i32}
+// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep {struct.CC} | grep {struct.payre<KBFP,float*} | grep {.base.32} | grep {1 x i32}
+// RUN: %llvmgxx -S -m32 -emit-llvm %s -o - | grep {struct.SRCFilter::FilterEntry} | not grep {1 x i32}
+// XFAIL: *
+// XTARGET: powerpc-apple-darwin
+
+template<class _T1, class _T2> struct payre {
+ _T1 first;
+ _T2 second;
+ payre() : first(), second() { }
+};
+struct KBFP {
+ double mCutoffFrequency;
+};
+class SRCFilter {
+ struct FilterEntry: public payre<KBFP, float*>{};
+ static FilterEntry foo;
+};
+SRCFilter::FilterEntry SRCFilter::foo; // 12 bytes
+payre<KBFP, float*> baz; // 16 bytes
+class CC { // 16 bytes
+ public: payre<KBFP, float*> x;
+};
+class CC ccc;
+
+struct bar { KBFP x; float* y;}; // 16 bytes
+struct bar quux;
+
diff --git a/test/FrontendC++/2009-06-30-ByrefBlock.cpp b/test/FrontendC++/2009-06-30-ByrefBlock.cpp
new file mode 100644
index 0000000..be9c94f
--- /dev/null
+++ b/test/FrontendC++/2009-06-30-ByrefBlock.cpp
@@ -0,0 +1,11 @@
+// Insure __block_holder_tmp is allocated on the stack. Darwin only.
+// RUN: %llvmgxx %s -S -O2 -o - | egrep {__block_holder_tmp.*alloca}
+// XFAIL: *
+// XTARGET: darwin
+// <rdar://problem/5865221>
+// END.
+extern void fubar_dispatch_sync(void (^PP)(void));
+void fubar() {
+ __block void *voodoo;
+ fubar_dispatch_sync(^(void){voodoo=0;});
+}
diff --git a/test/FrontendC++/2009-07-15-LineNumbers.cpp b/test/FrontendC++/2009-07-15-LineNumbers.cpp
new file mode 100644
index 0000000..a8eda77
--- /dev/null
+++ b/test/FrontendC++/2009-07-15-LineNumbers.cpp
@@ -0,0 +1,27 @@
+// This is a regression test on debug info to make sure that we can
+// print line numbers in asm.
+// RUN: %llvmgcc -S -O0 -g %s -o - | \
+// RUN: llc --disable-fp-elim -O0 -relocation-model=pic | grep { 2009-07-15-LineNumbers.cpp:25$}
+
+#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++/2009-07-16-PrivateCopyConstructor.cpp b/test/FrontendC++/2009-07-16-PrivateCopyConstructor.cpp
new file mode 100644
index 0000000..96e85b2
--- /dev/null
+++ b/test/FrontendC++/2009-07-16-PrivateCopyConstructor.cpp
@@ -0,0 +1,15 @@
+// RUN: %llvmgxx %s -S
+// XFAIL: darwin
+
+#include <set>
+
+class A {
+public:
+ A();
+private:
+ A(const A&);
+};
+void B()
+{
+ std::set<void *, A> foo;
+}
diff --git a/test/FrontendC++/2009-07-16-Using.cpp b/test/FrontendC++/2009-07-16-Using.cpp
new file mode 100644
index 0000000..1acadf6
--- /dev/null
+++ b/test/FrontendC++/2009-07-16-Using.cpp
@@ -0,0 +1,8 @@
+// RUN: %llvmgxx %s -S
+
+namespace A {
+ typedef int B;
+}
+struct B {
+};
+using ::A::B;
diff --git a/test/FrontendC++/2009-08-05-ZeroInitWidth.cpp b/test/FrontendC++/2009-08-05-ZeroInitWidth.cpp
new file mode 100644
index 0000000..bc862e7
--- /dev/null
+++ b/test/FrontendC++/2009-08-05-ZeroInitWidth.cpp
@@ -0,0 +1,12 @@
+// RUN: %llvmgxx -c -emit-llvm %s -o -
+// rdar://7114564
+struct A {
+ unsigned long long : (sizeof(unsigned long long) * 8) - 16;
+};
+struct B {
+ A a;
+};
+struct B b = {
+ {}
+};
+
diff --git a/test/FrontendC++/2009-08-11-VectorRetTy.cpp b/test/FrontendC++/2009-08-11-VectorRetTy.cpp
new file mode 100644
index 0000000..b2c3ba1
--- /dev/null
+++ b/test/FrontendC++/2009-08-11-VectorRetTy.cpp
@@ -0,0 +1,13 @@
+// RUN: %llvmgxx %s -c -o /dev/null
+// <rdar://problem/7096460>
+typedef void (*Func) ();
+typedef long long m64 __attribute__((__vector_size__(8), __may_alias__));
+static inline m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi16() {}
+template <class MM>
+static void Bork() {
+ const m64 mmx_0x00ff = _mm_set1_pi16();
+}
+struct A {};
+Func arr[] = {
+ Bork<A>
+};
diff --git a/test/FrontendC++/2009-09-04-modify-crash.cpp b/test/FrontendC++/2009-09-04-modify-crash.cpp
new file mode 100644
index 0000000..ac16f8c
--- /dev/null
+++ b/test/FrontendC++/2009-09-04-modify-crash.cpp
@@ -0,0 +1,7 @@
+// RUN: %llvmgxx %s -emit-llvm -fapple-kext -S -o -
+// The extra check in 71555 caused this to crash on Darwin X86
+// in an assert build.
+class foo {
+ virtual ~foo ();
+};
+foo::~foo(){}
diff --git a/test/FrontendC++/2009-09-09-packed-layout.cpp b/test/FrontendC++/2009-09-09-packed-layout.cpp
new file mode 100644
index 0000000..a569f9f
--- /dev/null
+++ b/test/FrontendC++/2009-09-09-packed-layout.cpp
@@ -0,0 +1,18 @@
+// RUN: %llvmgxx -S -m32 -emit-llvm %s -o /dev/null
+class X {
+ public:
+ virtual ~X();
+ short y;
+};
+#pragma pack(push, 1)
+class Z : public X {
+ public: enum { foo = ('x') };
+ virtual int y() const;
+};
+#pragma pack(pop)
+class Y : public X {
+public: enum { foo = ('y'), bar = 0 };
+};
+X x;
+Y y;
+Z z;
diff --git a/test/FrontendC++/2009-10-27-crash.cpp b/test/FrontendC++/2009-10-27-crash.cpp
new file mode 100644
index 0000000..5641aa4
--- /dev/null
+++ b/test/FrontendC++/2009-10-27-crash.cpp
@@ -0,0 +1,43 @@
+// RUN: %llvmgxx -emit-llvm -S %s
+// Radar 7328944
+
+typedef struct
+{
+ unsigned short a : 1;
+ unsigned short b : 2;
+ unsigned short c : 1;
+ unsigned short d : 1;
+ unsigned short e : 1;
+ unsigned short f : 1;
+ unsigned short g : 2;
+ unsigned short : 7;
+ union
+ {
+ struct
+ {
+ unsigned char h : 1;
+ unsigned char i : 1;
+ unsigned char j : 1;
+ unsigned char : 5;
+ };
+ struct
+ {
+ unsigned char k : 3;
+ unsigned char : 5;
+ };
+ };
+ unsigned char : 8;
+} tt;
+
+typedef struct
+{
+ unsigned char s;
+ tt t;
+ unsigned int u;
+} ttt;
+
+ttt X = {
+ 4,
+ { 0 },
+ 55,
+};
diff --git a/test/FrontendC++/2009-12-23-MissingSext.cpp b/test/FrontendC++/2009-12-23-MissingSext.cpp
new file mode 100644
index 0000000..ee97881
--- /dev/null
+++ b/test/FrontendC++/2009-12-23-MissingSext.cpp
@@ -0,0 +1,16 @@
+// RUN: %llvmgxx %s -S -o - | FileCheck %s
+// The store of p.y into the temporary was not
+// getting extended to 32 bits, so uninitialized
+// bits of the temporary were used. 7366161.
+struct foo {
+ char x:8;
+ signed int y:24;
+};
+int bar(struct foo p, int x) {
+// CHECK: bar
+// CHECK: sext
+// CHECK: sext
+ x = (p.y > x ? x : p.y);
+ return x;
+// CHECK: return
+}
diff --git a/test/FrontendC++/2010-02-08-NamespaceVar.cpp b/test/FrontendC++/2010-02-08-NamespaceVar.cpp
new file mode 100644
index 0000000..cd8247a
--- /dev/null
+++ b/test/FrontendC++/2010-02-08-NamespaceVar.cpp
@@ -0,0 +1,16 @@
+// RUN: %llvmgxx -S %s -o - | grep cX
+
+namespace C {
+ int c = 1;
+ namespace {
+ int cX = 6;
+ void marker2() {
+ cX;
+ }
+ }
+}
+
+int main() {
+ C::marker2();
+ return 0;
+}
diff --git a/test/FrontendC++/alignstack.cpp b/test/FrontendC++/alignstack.cpp
new file mode 100644
index 0000000..4f993d6
--- /dev/null
+++ b/test/FrontendC++/alignstack.cpp
@@ -0,0 +1,23 @@
+// RUN: %llvmgxx %s -fasm-blocks -S -o - | FileCheck %s
+// Complicated expression as jump target
+// XFAIL: *
+// XTARGET: x86,i386,i686,darwin
+
+void Method3()
+{
+// CHECK: Method3
+// CHECK-NOT: alignstack
+ asm("foo:");
+// CHECK: return
+}
+
+void Method4()
+{
+// CHECK: Method4
+// CHECK: alignstack
+ asm {
+ bar:
+ }
+// CHECK: return
+}
+
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++/integration-O2.cpp b/test/FrontendC++/integration-O2.cpp
new file mode 100644
index 0000000..bb65ac2
--- /dev/null
+++ b/test/FrontendC++/integration-O2.cpp
@@ -0,0 +1,19 @@
+// RUN: %llvmgxx %s -O2 -S -o - | FileCheck %s
+
+// This test verifies that we get expected codegen out of the -O2 optimization
+// level from the full optimizer.
+
+
+
+// Verify that ipsccp is running and can eliminate globals.
+static int test1g = 42;
+void test1f1() {
+ if (test1g == 0) test1g = 0;
+}
+int test1f2() {
+ return test1g;
+}
+
+// CHECK: @_Z7test1f2v()
+// CHECK: entry:
+// CHECK-NEXT: ret i32 42
diff --git a/test/FrontendC++/m64-ptr.cpp b/test/FrontendC++/m64-ptr.cpp
new file mode 100644
index 0000000..f91e2f4
--- /dev/null
+++ b/test/FrontendC++/m64-ptr.cpp
@@ -0,0 +1,19 @@
+// RUN: %llvmgxx %s -S -o - | FileCheck %s
+// XFAIL: powerpc-apple-darwin
+
+// Make sure pointers are passed as pointers, not converted to int.
+// The first load should be of type i8** in either 32 or 64 bit mode.
+// This formerly happened on x86-64, 7375899.
+
+class StringRef {
+public:
+ const char *Data;
+ long Len;
+};
+void foo(StringRef X);
+void bar(StringRef &A) {
+// CHECK: @_Z3barR9StringRef
+// CHECK: load i8**
+ foo(A);
+// CHECK: ret void
+}
diff --git a/test/FrontendC++/member-alignment.cpp b/test/FrontendC++/member-alignment.cpp
new file mode 100644
index 0000000..6afc0aa
--- /dev/null
+++ b/test/FrontendC++/member-alignment.cpp
@@ -0,0 +1,20 @@
+// RUN: %llvmgxx -S -emit-llvm %s -o - | FileCheck %s
+// XFAIL: arm,powerpc
+
+// rdar://7268289
+
+class t {
+public:
+ virtual void foo(void);
+ void bar(void);
+};
+
+void
+t::bar(void) {
+// CHECK: _ZN1t3barEv{{.*}} align 2
+}
+
+void
+t::foo(void) {
+// CHECK: _ZN1t3fooEv{{.*}} align 2
+}
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)();
+ }
diff --git a/test/FrontendC++/varargs.cpp b/test/FrontendC++/varargs.cpp
new file mode 100644
index 0000000..1c07aed
--- /dev/null
+++ b/test/FrontendC++/varargs.cpp
@@ -0,0 +1,19 @@
+// RUN: %llvmgxx -S -emit-llvm %s -o - | FileCheck %s
+// rdar://7309675
+// PR4678
+
+// test1 should be compmiled to be a varargs function in the IR even
+// though there is no way to do a va_begin. Otherwise, the optimizer
+// will warn about 'dropped arguments' at the call site.
+
+// CHECK: define i32 @_Z5test1z(...)
+int test1(...) {
+ return -1;
+}
+
+// CHECK: call i32 (...)* @_Z5test1z(i32 0)
+void test() {
+ test1(0);
+}
+
+
diff --git a/test/FrontendC++/weak-external.cpp b/test/FrontendC++/weak-external.cpp
new file mode 100644
index 0000000..94360c2
--- /dev/null
+++ b/test/FrontendC++/weak-external.cpp
@@ -0,0 +1,17 @@
+// RUN: %llvmgxx %s -S -emit-llvm -O2 -o - | not grep {_ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag}
+// PR4262
+
+// The "basic_string" extern template instantiation declaration is supposed to
+// suppress the implicit instantiation of non-inline member functions. Make sure
+// that we suppress the implicit instantiation of non-inline member functions
+// defined out-of-line. That we aren't instantiating the basic_string
+// constructor when we shouldn't be. Such an instantiation forces the implicit
+// instantiation of _S_construct<const char*>. Since _S_construct is a member
+// template, it's instantiation is *not* suppressed (despite being in
+// basic_string<char>), so we would emit it as a weak definition.
+
+#include <stdexcept>
+
+void dummysymbol() {
+ throw(std::runtime_error("string"));
+}
diff --git a/test/FrontendC++/x86-64-abi-sret-vs-2word-struct-param.cpp b/test/FrontendC++/x86-64-abi-sret-vs-2word-struct-param.cpp
new file mode 100644
index 0000000..ec69afc
--- /dev/null
+++ b/test/FrontendC++/x86-64-abi-sret-vs-2word-struct-param.cpp
@@ -0,0 +1,27 @@
+// RUN: %llvmgxx -S -emit-llvm %s -o - | grep byval | count 2
+// XTARGET: x86
+// PR4242
+// (PR 4242 bug is on 64-bit only, test passes on x86-32 as well)
+
+struct S {
+ void* data[3];
+};
+
+struct T {
+ void* data[2];
+};
+
+extern "C" S fail(int, int, int, int, T t, void* p) {
+ S s;
+ s.data[0] = t.data[0];
+ s.data[1] = t.data[1];
+ s.data[2] = p;
+ return s;
+}
+
+extern "C" S* succeed(S* sret, int, int, int, int, T t, void* p) {
+ sret->data[0] = t.data[0];
+ sret->data[1] = t.data[1];
+ sret->data[2] = p;
+ return sret;
+}