allow to enable the cuda mode of the compilerInstance

set the AuxTarget, if the LangOpt CUDA is true and enable the compilation of cuda runtime code
needs a preload of the libcudart.so and the arguments -std=c++11 and --cuda-host-only at start of cling
This commit is contained in:
Simeon Ehrig 2018-03-14 13:25:23 +01:00 committed by sftnight
parent 6bbf1f3311
commit 757fca022f

View File

@ -1116,6 +1116,15 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
Buffer = llvm::MemoryBuffer::getMemBuffer("/*CLING DEFAULT MEMBUF*/;\n");
const_cast<SrcMgr::ContentCache*>(MainFileCC)->setBuffer(std::move(Buffer));
// Create TargetInfo for the other side of CUDA and OpenMP compilation.
if ((CI->getLangOpts().CUDA || CI->getLangOpts().OpenMPIsDevice) &&
!CI->getFrontendOpts().AuxTriple.empty()) {
auto TO = std::make_shared<TargetOptions>();
TO->Triple = CI->getFrontendOpts().AuxTriple;
TO->HostTriple = CI->getTarget().getTriple().str();
CI->setAuxTarget(TargetInfo::CreateTargetInfo(CI->getDiagnostics(), TO));
}
// Set up the preprocessor
CI->createPreprocessor(TU_Complete);
Preprocessor& PP = CI->getPreprocessor();