Module: Mesa
Branch: staging/23.0
Commit: d55de21f0f67071daa64c0b67978aca007df0178
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d55de21f0f67071daa64c0b67978aca007df0178

Author: Jesse Natalie <[email protected]>
Date:   Tue Feb  7 11:16:11 2023 -0800

clc: Include opencl-c-base.h with LLVM 15 (using builtins)

Reviewed-by: Karol Herbst <[email protected]>
(cherry picked from commit b27d8ee2e916290a49943586726521ad2378a45f)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21467>

---

 src/compiler/clc/clc_helpers.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp
index fe30b6aac0f..80bc84831e4 100644
--- a/src/compiler/clc/clc_helpers.cpp
+++ b/src/compiler/clc/clc_helpers.cpp
@@ -849,12 +849,16 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
       ::llvm::sys::path::append(system_header_path, "opencl-c.h");
       c->getPreprocessorOpts().addRemappedFile(system_header_path.str(),
          ::llvm::MemoryBuffer::getMemBuffer(llvm::StringRef(opencl_c_source, 
ARRAY_SIZE(opencl_c_source) - 1)).release());
+      ::llvm::sys::path::remove_filename(system_header_path);
 #endif
 
-      ::llvm::sys::path::remove_filename(system_header_path);
       ::llvm::sys::path::append(system_header_path, "opencl-c-base.h");
       c->getPreprocessorOpts().addRemappedFile(system_header_path.str(),
          
::llvm::MemoryBuffer::getMemBuffer(llvm::StringRef(opencl_c_base_source, 
ARRAY_SIZE(opencl_c_base_source) - 1)).release());
+
+#if LLVM_VERSION_MAJOR >= 15
+      c->getPreprocessorOpts().Includes.push_back("opencl-c-base.h");
+#endif
    }
 #else
    // GetResourcePath is a way to retrive the actual libclang resource dir 
based on a given binary

Reply via email to