diff --git a/src/gallium/frontends/clover/llvm/compat.hpp b/src/gallium/frontends/clover/llvm/compat.hpp index 78eb8c982a8..d537819f292 100644 --- a/src/gallium/frontends/clover/llvm/compat.hpp +++ b/src/gallium/frontends/clover/llvm/compat.hpp @@ -38,14 +38,14 @@ #include +#include +#include +#include #include #include +#include #include #include -#include - -#include -#include #include #include @@ -88,6 +88,20 @@ namespace clover { cinv, copts.data(), copts.data() + copts.size(), diag); #endif } + + static inline void + compiler_set_lang_defaults(std::unique_ptr &c, + clang::InputKind ik, const ::llvm::Triple& triple, + clang::LangStandard::Kind d) + { + c->getInvocation().setLangDefaults(c->getLangOpts(), ik, triple, +#if LLVM_VERSION_MAJOR >= 12 + c->getPreprocessorOpts().Includes, +#else + c->getPreprocessorOpts(), +#endif + d); + } } } } diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp index 536e952b100..30592e4343b 100644 --- a/src/gallium/frontends/clover/llvm/invocation.cpp +++ b/src/gallium/frontends/clover/llvm/invocation.cpp @@ -247,9 +247,8 @@ namespace { // http://www.llvm.org/bugs/show_bug.cgi?id=19735 c->getDiagnosticOpts().ShowCarets = false; - c->getInvocation().setLangDefaults(c->getLangOpts(), - compat::ik_opencl, ::llvm::Triple(target.triple), - c->getPreprocessorOpts(), + compat::compiler_set_lang_defaults(c, compat::ik_opencl, + ::llvm::Triple(target.triple), get_language_version(opts, device_clc_version)); c->createDiagnostics(new clang::TextDiagnosticPrinter(