klee/0012-llvm40-handle-different-header-names.patch

89 lines
2.5 KiB
Diff

From: Jiri Slaby <jirislaby@gmail.com>
Date: Wed, 7 Jun 2017 14:57:45 +0200
Subject: llvm40: handle different header names
Patch-mainline: no
LLVM 4.0 renamed and split some headers. Take this into account in
includes.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
lib/Module/KModule.cpp | 4 ++++
lib/Module/ModuleUtil.cpp | 9 ++++++++-
tools/klee/main.cpp | 7 ++++++-
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 75e71c0a557f..232cd88fd621 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -21,7 +21,11 @@
#include "klee/Internal/Support/Debug.h"
#include "klee/Internal/Support/ModuleUtil.h"
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
+#include "llvm/Bitcode/BitcodeWriter.h"
+#else
#include "llvm/Bitcode/ReaderWriter.h"
+#endif
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
index ee4af254dae2..8aa070743048 100644
--- a/lib/Module/ModuleUtil.cpp
+++ b/lib/Module/ModuleUtil.cpp
@@ -26,7 +26,9 @@
#include "llvm/Object/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/SourceMgr.h"
+#if LLVM_VERSION_CODE < LLVM_VERSION(4, 0)
#include "llvm/Support/DataStream.h"
+#endif
#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5)
#include "llvm/Linker.h"
@@ -36,8 +38,13 @@
#include "llvm/IR/AssemblyAnnotationWriter.h"
#endif
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
+#include <llvm/Bitcode/BitcodeReader.h>
+#else
+#include <llvm/Bitcode/ReaderWriter.h>
+#endif
+
#include "llvm/Analysis/ValueTracking.h"
-#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Path.h"
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index c0ea4fa54551..154a76feb361 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -31,7 +31,6 @@
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/FileSystem.h"
-#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -45,6 +44,12 @@
#include "llvm/Support/system_error.h"
#endif
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
+#include <llvm/Bitcode/BitcodeReader.h>
+#else
+#include <llvm/Bitcode/ReaderWriter.h>
+#endif
+
#include <dirent.h>
#include <signal.h>
#include <unistd.h>
--
2.17.1