about summary refs log tree commit diff homepage
path: root/test/CXX/symex/libc++/dynamic_cast.cpp
diff options
context:
space:
mode:
authorFelix Rath <felix.rath@comsys.rwth-aachen.de>2020-05-22 14:09:10 +0200
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2020-10-12 11:19:24 +0100
commitc09306ffd894f95be195723327d5b17dca73ebd1 (patch)
tree592773383280012bce8856b28503ab61de0deb98 /test/CXX/symex/libc++/dynamic_cast.cpp
parentd920e049fa955877f772188fdc58cab1b31aabc9 (diff)
downloadklee-c09306ffd894f95be195723327d5b17dca73ebd1.tar.gz
Implemented support for C++ Exceptions
We implement the Itanium ABI unwinding base-API, and leave the
C++-specific parts to libcxxabi.

Co-authored-by: Lukas Wölfer <lukas.woelfer@rwth-aachen.de>
Diffstat (limited to 'test/CXX/symex/libc++/dynamic_cast.cpp')
-rw-r--r--test/CXX/symex/libc++/dynamic_cast.cpp56
1 files changed, 27 insertions, 29 deletions
diff --git a/test/CXX/symex/libc++/dynamic_cast.cpp b/test/CXX/symex/libc++/dynamic_cast.cpp
index c2d8b528..a2fc8b82 100644
--- a/test/CXX/symex/libc++/dynamic_cast.cpp
+++ b/test/CXX/symex/libc++/dynamic_cast.cpp
@@ -1,54 +1,52 @@
+// REQUIRES: not-msan
+// Disabling msan because it times out on CI
 // REQUIRES: libcxx
 // REQUIRES: uclibc
 // RUN: %clangxx %s -emit-llvm %O0opt -c -std=c++11 -I "%libcxx_include" -g -nostdinc++ -o %t1.bc
 // RUN: rm -rf %t.klee-out
-// RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --libcxx %t1.bc
-//
+// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --libcxx %t1.bc
+
 // Copied from 'http://en.cppreference.com/w/cpp/language/dynamic_cast'
 
 struct V {
-    virtual void f() {};  // must be polymorphic to use runtime-checked dynamic_cast
+  virtual void f(){}; // must be polymorphic to use runtime-checked dynamic_cast
 };
 struct A : virtual V {};
 struct B : virtual V {
-  B(V* v, A* a) {
+  B(V *v, A *a) {
     // casts during construction (see the call in the constructor of D below)
-    dynamic_cast<B*>(v); // well-defined: v of type V*, V base of B, results in B*
-    dynamic_cast<B*>(a); // undefined behavior: a has type A*, A not a base of B
+    dynamic_cast<B *>(v); // well-defined: v of type V*, V base of B, results in B*
+    dynamic_cast<B *>(a); // undefined behavior: a has type A*, A not a base of B
   }
 };
 struct D : A, B {
-    D() : B((A*)this, this) { }
+  D() : B((A *)this, this) {}
 };
 
 struct Base {
-    virtual ~Base() {}
+  virtual ~Base() {}
 };
 
-struct Derived: Base {
-    virtual void name() {}
+struct Derived : Base {
+  virtual void name() {}
 };
 
-int main()
-{
-    D d; // the most derived object
-    A& a = d; // upcast, dynamic_cast may be used, but unnecessary
-    D& new_d = dynamic_cast<D&>(a); // downcast
-    B& new_b = dynamic_cast<B&>(a); // sidecast
-
+int main() {
+  D d;                             // the most derived object
+  A &a = d;                        // upcast, dynamic_cast may be used, but unnecessary
+  D &new_d = dynamic_cast<D &>(a); // downcast
+  B &new_b = dynamic_cast<B &>(a); // sidecast
 
-    Base* b1 = new Base;
-    if(Derived* d = dynamic_cast<Derived*>(b1))
-    {
-        d->name(); // safe to call
-    }
+  Base *b1 = new Base;
+  if (Derived *d = dynamic_cast<Derived *>(b1)) {
+    d->name(); // safe to call
+  }
 
-    Base* b2 = new Derived;
-    if(Derived* d = dynamic_cast<Derived*>(b2))
-    {
-        d->name(); // safe to call
-    }
+  Base *b2 = new Derived;
+  if (Derived *d = dynamic_cast<Derived *>(b2)) {
+    d->name(); // safe to call
+  }
 
-    delete b1;
-    delete b2;
+  delete b1;
+  delete b2;
 }