about summary refs log tree commit diff homepage
path: root/include
diff options
context:
space:
mode:
authorJulian Büning <julian.buening@rwth-aachen.de>2020-10-10 15:13:40 +0200
committerCristian Cadar <c.cadar@imperial.ac.uk>2020-11-12 10:13:54 +0000
commitbda35257b64545870c6de5fe8aba573ef82945d9 (patch)
tree0ed00a0d18ffb012518abc23342701e20459035e /include
parentc763a4087f1d8fa4dbdfb9c8f30d545cdb66a0aa (diff)
downloadklee-bda35257b64545870c6de5fe8aba573ef82945d9.tar.gz
Casting.h: isa_and_nonnull<>
Diffstat (limited to 'include')
-rw-r--r--include/klee/ADT/Ref.h7
-rw-r--r--include/klee/Support/Casting.h35
2 files changed, 36 insertions, 6 deletions
diff --git a/include/klee/ADT/Ref.h b/include/klee/ADT/Ref.h
index 7267f894..a40ed238 100644
--- a/include/klee/ADT/Ref.h
+++ b/include/klee/ADT/Ref.h
@@ -29,12 +29,7 @@
 #ifndef KLEE_REF_H
 #define KLEE_REF_H
 
-#include "llvm/Support/Casting.h"
-using llvm::isa;
-using llvm::cast;
-using llvm::cast_or_null;
-using llvm::dyn_cast;
-using llvm::dyn_cast_or_null;
+#include "klee/Support/Casting.h"
 
 #include <cassert>
 #include <iosfwd> // FIXME: Remove this when LLVM 4.0 support is removed!!!
diff --git a/include/klee/Support/Casting.h b/include/klee/Support/Casting.h
new file mode 100644
index 00000000..865218a0
--- /dev/null
+++ b/include/klee/Support/Casting.h
@@ -0,0 +1,35 @@
+//===-- Casting.h -----------------------------------------------*- C++ -*-===//
+//
+//                     The KLEE Symbolic Virtual Machine
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef KLEE_CASTING_H
+#define KLEE_CASTING_H
+
+#include "klee/Config/Version.h"
+
+#include "llvm/Support/Casting.h"
+
+namespace klee {
+
+using llvm::cast;
+using llvm::cast_or_null;
+using llvm::dyn_cast;
+using llvm::dyn_cast_or_null;
+using llvm::isa;
+#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0)
+using llvm::isa_and_nonnull;
+#else
+template <typename... X, typename Y>
+inline bool isa_and_nonnull(const Y &value) {
+  return value && isa<X...>(value);
+}
+#endif
+
+} // namespace klee
+
+#endif /* KLEE_CASTING_H */
\ No newline at end of file