241 ,
diag_id(
new clang::DiagnosticIDs())
244 ,
the_driver(clang_path.c_str(), llvm::sys::getDefaultTargetTriple(),
diags)
248 if (!boost::filesystem::exists(
the_driver.ResourceDir)) {
250 <<
" does not exist";
255 std::string clang_resource_dir =
exec_output(clang_path +
" -print-resource-dir");
258 clang_resource_dir.erase(
259 std::find_if(clang_resource_dir.rbegin(),
260 clang_resource_dir.rend(),
261 [](
unsigned char ch) {
return !std::isspace(ch); })
263 clang_resource_dir.end());
265 if (clang_resource_dir !=
the_driver.ResourceDir) {
266 LOG(
WARNING) <<
"Resetting clang driver ResourceDir to " << clang_resource_dir
272 #if LLVM_VERSION_MAJOR >= 10
274 #
if LLVM_VERSION_MAJOR >= 14
275 clang::diag::warn_drv_new_cuda_version,
277 clang::diag::warn_drv_unknown_cuda_version,
279 clang::diag::Severity::Ignored,
280 clang::SourceLocation());
285 diags.setSeverity(clang::diag::err_drv_no_cuda_libdevice,
286 clang::diag::Severity::Ignored,
287 clang::SourceLocation());
std::unique_ptr< clang::DiagnosticConsumer > diag_client_owner
clang::DiagnosticsEngine diags
llvm::IntrusiveRefCntPtr< clang::DiagnosticIDs > diag_id
clang::driver::Driver the_driver
std::string exec_output(std::string cmd)
std::tuple< int, int, int > get_clang_version(const std::string &clang_path)
std::tuple< int, int, int > clang_version
clang::DiagnosticConsumer * diag_client
llvm::IntrusiveRefCntPtr< clang::DiagnosticOptions > diag_options