[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/2006-12-04-DynAllocAndRestore.cpp

Jim Laskey jlaskey at apple.com
Mon Dec 4 14:01:09 PST 2006



Changes in directory llvm-test/SingleSource/UnitTests:

2006-12-04-DynAllocAndRestore.cpp added (r1.1)
---
Log message:

Make sure that restore stack does the right thing.

---
Diffs of the changes:  (+47 -0)

 2006-12-04-DynAllocAndRestore.cpp |   47 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+)


Index: llvm-test/SingleSource/UnitTests/2006-12-04-DynAllocAndRestore.cpp
diff -c /dev/null llvm-test/SingleSource/UnitTests/2006-12-04-DynAllocAndRestore.cpp:1.1
*** /dev/null	Mon Dec  4 16:01:04 2006
--- llvm-test/SingleSource/UnitTests/2006-12-04-DynAllocAndRestore.cpp	Mon Dec  4 16:00:54 2006
***************
*** 0 ****
--- 1,47 ----
+ 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);
+   BDT.doit();
+   return 0;
+ }






More information about the llvm-commits mailing list