summaryrefslogtreecommitdiff
path: root/compiler-rt/test/cfi/utils.h
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-02-21 01:36:08 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-02-21 01:36:08 +0000
commitf1d13da249d52dc549945aacb1c4059e4079e412 (patch)
treecc9e64995ca13aa4163ffc6bb988040755d63ee2 /compiler-rt/test/cfi/utils.h
parent5870373d19547b3e05bc1ec1df3b534d999e1d82 (diff)
downloadllvm-f1d13da249d52dc549945aacb1c4059e4079e412.tar.gz
CFI: Add tests for 32-bit, 64-bit and memory bitsets. Break optimization in more places.
llvm-svn: 230116
Diffstat (limited to 'compiler-rt/test/cfi/utils.h')
-rw-r--r--compiler-rt/test/cfi/utils.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/compiler-rt/test/cfi/utils.h b/compiler-rt/test/cfi/utils.h
new file mode 100644
index 000000000000..5c290d151069
--- /dev/null
+++ b/compiler-rt/test/cfi/utils.h
@@ -0,0 +1,53 @@
+#ifndef UTILS_H
+#define UTILS_H
+
+inline void break_optimization(void *arg) {
+ __asm__ __volatile__("" : : "r" (arg) : "memory");
+}
+
+// Tests will instantiate this class to pad out bit sets to test out the various
+// ways we can represent the bit set (32-bit inline, 64-bit inline, memory).
+// This class has 37 virtual member functions, which forces us to use a
+// pointer-aligned bitset.
+template <typename T, unsigned I>
+class Deriver : T {
+ virtual void f() {}
+ virtual void g() {}
+ virtual void f1() {}
+ virtual void f2() {}
+ virtual void f3() {}
+ virtual void f4() {}
+ virtual void f5() {}
+ virtual void f6() {}
+ virtual void f7() {}
+ virtual void f8() {}
+ virtual void f9() {}
+ virtual void f10() {}
+ virtual void f11() {}
+ virtual void f12() {}
+ virtual void f13() {}
+ virtual void f14() {}
+ virtual void f15() {}
+ virtual void f16() {}
+ virtual void f17() {}
+ virtual void f18() {}
+ virtual void f19() {}
+ virtual void f20() {}
+ virtual void f21() {}
+ virtual void f22() {}
+ virtual void f23() {}
+ virtual void f24() {}
+ virtual void f25() {}
+ virtual void f26() {}
+ virtual void f27() {}
+ virtual void f28() {}
+ virtual void f29() {}
+ virtual void f30() {}
+ virtual void f31() {}
+ virtual void f32() {}
+ virtual void f33() {}
+ virtual void f34() {}
+ virtual void f35() {}
+};
+
+#endif