Improve consistency for cling -x cuda.

This commit is contained in:
Axel Naumann 2016-11-09 17:53:50 +01:00 committed by sftnight
parent a8bce0d416
commit 87a972e570
2 changed files with 6 additions and 1 deletions

View File

@ -731,7 +731,7 @@ namespace {
const SrcMgr::ContentCache* MainFileCC
= MainFileSLocE.getFile().getContentCache();
if (!Buffer)
Buffer = llvm::MemoryBuffer::getMemBuffer("/*CLING DEFAULT MEMBUF*/\n");
Buffer = llvm::MemoryBuffer::getMemBuffer("/*CLING DEFAULT MEMBUF*/;\n");
const_cast<SrcMgr::ContentCache*>(MainFileCC)->setBuffer(std::move(Buffer));
// Set up the preprocessor

View File

@ -177,6 +177,11 @@ namespace cling {
if (External)
External->StartTranslationUnit(m_Consumer);
Parser::DeclGroupPtrTy ADecl;
// Start parsing the "main file" to warm up lexing (enter caching lex mode
// for ParseInternal()'s call EnterSourceFile() to make sense.
while (!m_Parser->ParseTopLevelDecl(ADecl)) {}
// If I belong to the parent Interpreter, only then do
// the #include <new>
if (!isChildInterpreter && m_CI->getLangOpts().CPlusPlus) {