diff options
Diffstat (limited to 'compiler-rt/test/cfi/multiple-inheritance.cpp')
-rw-r--r-- | compiler-rt/test/cfi/multiple-inheritance.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/compiler-rt/test/cfi/multiple-inheritance.cpp b/compiler-rt/test/cfi/multiple-inheritance.cpp index 1b03af4a1ba..523af6f72f2 100644 --- a/compiler-rt/test/cfi/multiple-inheritance.cpp +++ b/compiler-rt/test/cfi/multiple-inheritance.cpp @@ -2,6 +2,18 @@ // RUN: not --crash %t 2>&1 | FileCheck --check-prefix=CFI %s // RUN: not --crash %t x 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: %clangxx_cfi -DB32 -o %t %s +// RUN: not --crash %t 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t x 2>&1 | FileCheck --check-prefix=CFI %s + +// RUN: %clangxx_cfi -DB64 -o %t %s +// RUN: not --crash %t 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t x 2>&1 | FileCheck --check-prefix=CFI %s + +// RUN: %clangxx_cfi -DBM -o %t %s +// RUN: not --crash %t 2>&1 | FileCheck --check-prefix=CFI %s +// RUN: not --crash %t x 2>&1 | FileCheck --check-prefix=CFI %s + // RUN: %clangxx -o %t %s // RUN: %t 2>&1 | FileCheck --check-prefix=NCFI %s // RUN: %t x 2>&1 | FileCheck --check-prefix=NCFI %s @@ -10,6 +22,7 @@ // permits calls via virtual tables for the correct base class. #include <stdio.h> +#include "utils.h" struct A { virtual void f() = 0; @@ -27,7 +40,29 @@ void C::f() {} void C::g() {} int main(int argc, char **argv) { +#ifdef B32 + break_optimization(new Deriver<A, 0>); + break_optimization(new Deriver<B, 0>); +#endif + +#ifdef B64 + break_optimization(new Deriver<A, 0>); + break_optimization(new Deriver<A, 1>); + break_optimization(new Deriver<B, 0>); + break_optimization(new Deriver<B, 1>); +#endif + +#ifdef BM + break_optimization(new Deriver<A, 0>); + break_optimization(new Deriver<A, 1>); + break_optimization(new Deriver<A, 2>); + break_optimization(new Deriver<B, 0>); + break_optimization(new Deriver<B, 1>); + break_optimization(new Deriver<B, 2>); +#endif + C *c = new C; + break_optimization(c); // CFI: 1 // NCFI: 1 |