aboutsummaryrefslogtreecommitdiff
path: root/test/C++Frontend/2006-11-30-NoCompileUnit.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-07-17 06:20:38 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-07-17 06:20:38 +0000
commitcb5da4a8b63696acda016a829257e6c68d938324 (patch)
tree2dfc4abe37f4900539043570bb55e78ba3eca5c9 /test/C++Frontend/2006-11-30-NoCompileUnit.cpp
parentc3dbe70ce75e2fff00f6ea876ba9c39af4510d06 (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/2006-11-30-NoCompileUnit.cpp')
-rw-r--r--test/C++Frontend/2006-11-30-NoCompileUnit.cpp58
1 files changed, 58 insertions, 0 deletions
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();
+}