diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/klee/ADT/Ref.h | 7 | ||||
-rw-r--r-- | include/klee/Support/Casting.h | 35 |
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 |