diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-07-17 06:20:38 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-07-17 06:20:38 +0000 |
commit | cb5da4a8b63696acda016a829257e6c68d938324 (patch) | |
tree | 2dfc4abe37f4900539043570bb55e78ba3eca5c9 /test/C++Frontend | |
parent | c3dbe70ce75e2fff00f6ea876ba9c39af4510d06 (diff) |
For PR1558:
Move tests that have C/C++ sources into the appropriate directory. This
allows them to be selected for testing based on whether llvm-gcc is
present or not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39963 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/C++Frontend')
-rw-r--r-- | test/C++Frontend/2006-11-06-StackTrace.cpp | 36 | ||||
-rw-r--r-- | test/C++Frontend/2006-11-20-GlobalSymbols.cpp | 10 | ||||
-rw-r--r-- | test/C++Frontend/2006-11-30-NoCompileUnit.cpp | 58 | ||||
-rw-r--r-- | test/C++Frontend/2006-11-30-Pubnames.cpp | 20 | ||||
-rw-r--r-- | test/C++Frontend/2007-01-02-UnboundedArray.cpp | 14 |
5 files changed, 138 insertions, 0 deletions
diff --git a/test/C++Frontend/2006-11-06-StackTrace.cpp b/test/C++Frontend/2006-11-06-StackTrace.cpp new file mode 100644 index 0000000000..621a301eb2 --- /dev/null +++ b/test/C++Frontend/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: as %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. Should generalize? +// XFAIL: i[1-9]86|alpha|ia64|arm|x86_64|amd64 + +#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/C++Frontend/2006-11-20-GlobalSymbols.cpp b/test/C++Frontend/2006-11-20-GlobalSymbols.cpp new file mode 100644 index 0000000000..fc896b330a --- /dev/null +++ b/test/C++Frontend/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/C++Frontend/2006-11-30-NoCompileUnit.cpp b/test/C++Frontend/2006-11-30-NoCompileUnit.cpp new file mode 100644 index 0000000000..993ceb484c --- /dev/null +++ b/test/C++Frontend/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 Output/NoCompileUnit.s -f +// RUN: as Output/NoCompileUnit.s -o Output/NoCompileUnit.o +// RUN: g++ Output/NoCompileUnit.o -o Output/NoCompileUnit.exe +// RUN: echo {break main\nrun\np NoCompileUnit::pubname} > %t2 +// RUN: gdb -q -batch -n -x %t2 Output/NoCompileUnit.exe | \ +// RUN: tee Output/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/C++Frontend/2006-11-30-Pubnames.cpp b/test/C++Frontend/2006-11-30-Pubnames.cpp new file mode 100644 index 0000000000..698f30bc05 --- /dev/null +++ b/test/C++Frontend/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: as %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/C++Frontend/2007-01-02-UnboundedArray.cpp b/test/C++Frontend/2007-01-02-UnboundedArray.cpp new file mode 100644 index 0000000000..648d19be62 --- /dev/null +++ b/test/C++Frontend/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; +} |