clover: Fix build after clang r370122.

../mesa/src/gallium/state_trackers/clover/llvm/invocation.cpp: In function ‘std::unique_ptr<clang::CompilerInstance> {anonymous}::create_compiler_instance(const clover::device&, const std::vector<std::__cxx11::basic_string<char> >&, std::string&)’:
../mesa/src/gallium/state_trackers/clover/llvm/invocation.cpp:203:81: error: no matching function for call to ‘clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, const char* const*, const char* const*, clang::DiagnosticsEngine&)’
  203 |              c->getInvocation(), copts.data(), copts.data() + copts.size(), diag))
      |                                                                                 ^
In file included from /opt/llvm64/include/clang/Frontend/CompilerInstance.h:15,
                 from ../mesa/src/gallium/state_trackers/clover/llvm/codegen.hpp:37,
                 from ../mesa/src/gallium/state_trackers/clover/llvm/invocation.cpp:49:
/opt/llvm64/include/clang/Frontend/CompilerInvocation.h:157:15: note: candidate: ‘static bool clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<const char*>, clang::DiagnosticsEngine&)’
  157 |   static bool CreateFromArgs(CompilerInvocation &Res,
      |               ^~~~~~~~~~~~~~
/opt/llvm64/include/clang/Frontend/CompilerInvocation.h:157:15: note:   candidate expects 3 arguments, 4 provided

Signed-off-by: Hal Gentz <zegentzy@protonmail.com>
Reviewed-by: Aaron Watry <awatry@gmail.com>
This commit is contained in:
Hal Gentz 2019-09-01 17:31:04 -06:00 committed by Aaron Watry
parent e716a9e213
commit 55c912883c
2 changed files with 16 additions and 2 deletions

View file

@ -167,6 +167,20 @@ namespace clover {
#endif
}
template<typename T> inline bool
create_compiler_invocation_from_args(clang::CompilerInvocation &cinv,
T copts,
clang::DiagnosticsEngine &diag)
{
#if HAVE_LLVM >= 0x1000
return clang::CompilerInvocation::CreateFromArgs(
cinv, copts, diag);
#else
return clang::CompilerInvocation::CreateFromArgs(
cinv, copts.data(), copts.data() + copts.size(), diag);
#endif
}
template<typename T, typename M>
T get_abi_type(const T &arg_type, const M &mod) {
#if HAVE_LLVM >= 0x0700

View file

@ -199,8 +199,8 @@ namespace {
const target &target = dev.ir_target();
const std::string &device_clc_version = dev.device_clc_version();
if (!clang::CompilerInvocation::CreateFromArgs(
c->getInvocation(), copts.data(), copts.data() + copts.size(), diag))
if (!compat::create_compiler_invocation_from_args(
c->getInvocation(), copts, diag))
throw invalid_build_options_error();
diag_buffer->FlushDiagnostics(diag);