Improve the search of the clang instance for CUDA.

Before, it was not possible to find the clang++, which is contained in the cling, if we don't start the clang from the bin folder ('./cling -xcuda'). Now, for example it is possible to start the cling with 'bin/cling -xcuda' .

Fix a Bug, which avoid to start './cling -xcuda -fsyntax-only'.
This commit is contained in:
Simeon Ehrig 2018-04-18 13:48:49 +02:00 committed by sftnight
parent 2b61966c0d
commit d14ab2daec
2 changed files with 9 additions and 3 deletions

View File

@ -125,7 +125,12 @@ namespace cling {
cling::InvocationOptions & invocationOptions){
// Search after clang in the folder of cling.
llvm::SmallString<128> cwd;
llvm::sys::fs::current_path(cwd);
// get folder of the cling executable to find the clang which is contained
// in cling
// nullptr is ok, if we are the main and not a shared library
cwd.append(llvm::sys::path::parent_path(
llvm::sys::fs::getMainExecutable(
invocationOptions.CompilerOpts.Remaining[0], (void *) &cwd)));
cwd.append(llvm::sys::path::get_separator());
cwd.append("clang++");
m_ClangPath = cwd.c_str();

View File

@ -793,8 +793,9 @@ namespace cling {
else if (Diags.getNumWarnings())
return kSuccessWithWarnings;
if(m_CI->getLangOpts().CUDA )
m_Interpreter->getCUDADeviceCompiler().generateFatbinary(input, m_Consumer->getTransaction());
if(!m_Interpreter->isInSyntaxOnlyMode() && m_CI->getLangOpts().CUDA )
m_Interpreter->getCUDADeviceCompiler()
.generateFatbinary(input, m_Consumer->getTransaction());
return kSuccess;
}