Apply Axel's suggestion for PR "Fixed cling argumenent --cuda-path"

- see: https://github.com/root-project/root/pull/6707
This commit is contained in:
Simeon Ehrig 2021-02-05 10:20:48 +00:00 committed by jenkins
parent d00b927467
commit da1bb78f3d
4 changed files with 10 additions and 10 deletions

View File

@ -693,7 +693,9 @@ namespace cling {
clang::Sema& getSema() const;
clang::DiagnosticsEngine& getDiagnostics() const;
IncrementalCUDADeviceCompiler* getCUDACompiler() const;
IncrementalCUDADeviceCompiler* getCUDACompiler() const {
return m_CUDACompiler.get();
}
///\brief Create suitable default compilation options.
CompilationOptions makeDefaultCompilationOpts() const;

View File

@ -873,7 +873,7 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
}
static llvm::IntrusiveRefCntPtr<DiagnosticsEngine>
SetupDiagnostics(DiagnosticOptions& DiagOpts, std::string ExeName) {
SetupDiagnostics(DiagnosticOptions& DiagOpts, const std::string& ExeName) {
// The compiler invocation is the owner of the diagnostic options.
// Everything else points to them.
llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> DiagIDs(new DiagnosticIDs());
@ -1336,9 +1336,11 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
DiagnosticOptions& DiagOpts = InvocationPtr->getDiagnosticOpts();
// add prefix to diagnostic messages if second compiler instance is existing
// e.g. in CUDA mode
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags = SetupDiagnostics(
DiagOpts,
COpts.CUDAHost ? (COpts.CUDADevice ? "cling-ptx" : "cling") : "");
std::string ExeName = "";
if (COpts.CUDAHost)
ExeName = COpts.CUDADevice ? "cling-ptx" : "cling";
llvm::IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
SetupDiagnostics(DiagOpts, ExeName);
if (!Diags) {
cling::errs() << "Could not setup diagnostic engine.\n";
return nullptr;

View File

@ -157,7 +157,7 @@ namespace cling {
additionalPtxOpt.push_back(s);
}
// add manual path to CUDA SDK
// use custom CUDA SDK path
if(!invocationOptions.CompilerOpts.CUDAPath.empty()){
additionalPtxOpt.push_back("--cuda-path=" + invocationOptions.CompilerOpts.CUDAPath);
}

View File

@ -746,10 +746,6 @@ namespace cling {
return getCI()->getDiagnostics();
}
IncrementalCUDADeviceCompiler* Interpreter::getCUDACompiler() const {
return m_CUDACompiler.get();
}
CompilationOptions Interpreter::makeDefaultCompilationOpts() const {
CompilationOptions CO;
CO.DeclarationExtraction = 0;