summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2016-07-19 15:07:23 +0000
committerTom Stellard <[email protected]>2016-07-20 21:15:53 +0000
commit106946153fb237e0867d65d53fb3a8461f3a13ee (patch)
treea8cf457f289e702271ecc1743bfcf98a15bd813d
parenta73bf11a63ea93640c26b5701c533b06d3a6f3e9 (diff)
clover: Re-order includes in invocation.cpp to fix build
The build was failing because the official CL headers have a few defines, like: # define cl_khr_gl_sharing 1 Which have the same name as some class members of clang's OpenCLOptions class. If we include the cl headers first, this breaks the build because the member names of this class are replaced by the literal 1. Reviewed-by: Francisco Jerez <[email protected]> Reviewed-by: Vedran Miletić <[email protected]>
-rw-r--r--src/gallium/state_trackers/clover/llvm/invocation.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index 43f5e7325b9..5490d7254eb 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -24,13 +24,6 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
-#include "llvm/codegen.hpp"
-#include "llvm/compat.hpp"
-#include "llvm/invocation.hpp"
-#include "llvm/metadata.hpp"
-#include "llvm/util.hpp"
-#include "util/algorithm.hpp"
-
#include <llvm/IR/DiagnosticPrinter.h>
#include <llvm/IR/DiagnosticInfo.h>
#include <llvm/IR/LLVMContext.h>
@@ -44,6 +37,23 @@
#include <clang/Frontend/TextDiagnosticPrinter.h>
#include <clang/Basic/TargetInfo.h>
+// We need to include internal headers last, because the internal headers
+// include CL headers which have #define's like:
+//
+//#define cl_khr_gl_sharing 1
+//#define cl_khr_icd 1
+//
+// Which will break the compilation of clang/Basic/OpenCLOptions.h
+
+#include "core/error.hpp"
+#include "llvm/codegen.hpp"
+#include "llvm/compat.hpp"
+#include "llvm/invocation.hpp"
+#include "llvm/metadata.hpp"
+#include "llvm/util.hpp"
+#include "util/algorithm.hpp"
+
+
using namespace clover;
using namespace clover::llvm;