Pass in a includer's source location so clang can compare source locations.
This fixes a long standing issue with a clang assert when comparing with a location coming from the lookup helper.
This commit is contained in:
parent
1a68292a33
commit
0aa66b1e48
@ -273,8 +273,10 @@ namespace cling {
|
||||
llvm::MemoryBuffer* SB =
|
||||
llvm::MemoryBuffer::getMemBufferCopy(className.str() + "\n",
|
||||
"lookup.type.file");
|
||||
clang::FileID FID = S.getSourceManager().createFileID(SB);
|
||||
SourceLocation NewLoc = m_Interpreter->getNextAvailableLoc();
|
||||
FileID FID = S.getSourceManager().createFileID(SB, SrcMgr::C_User,
|
||||
/*LoadedID*/0,
|
||||
/*LoadedOffset*/0, NewLoc);
|
||||
PP.EnterSourceFile(FID, /*DirLookup*/0, NewLoc);
|
||||
PP.Lex(const_cast<clang::Token&>(P.getCurToken()));
|
||||
|
||||
@ -780,8 +782,10 @@ namespace cling {
|
||||
llvm::MemoryBuffer* SB
|
||||
= llvm::MemoryBuffer::getMemBufferCopy(funcName.str()
|
||||
+ "\n", "lookup.funcname.file");
|
||||
clang::FileID FID = S.getSourceManager().createFileID(SB);
|
||||
SourceLocation NewLoc = Interp->getNextAvailableLoc();
|
||||
FileID FID = S.getSourceManager().createFileID(SB, SrcMgr::C_User,
|
||||
/*LoadedID*/0,
|
||||
/*LoadedOffset*/0, NewLoc);
|
||||
PP.EnterSourceFile(FID, /*DirLookup*/0, NewLoc);
|
||||
PP.Lex(const_cast<clang::Token&>(P.getCurToken()));
|
||||
}
|
||||
@ -1503,13 +1507,15 @@ namespace cling {
|
||||
llvm::MemoryBuffer* SB
|
||||
= llvm::MemoryBuffer::getMemBufferCopy(code.str() + "\n",
|
||||
bufferName.str());
|
||||
FileID FID = S.getSourceManager().createFileID(SB);
|
||||
SourceLocation NewLoc = m_Interpreter->getNextAvailableLoc();
|
||||
FileID FID = S.getSourceManager().createFileID(SB, SrcMgr::C_User,
|
||||
/*LoadedID*/0,
|
||||
/*LoadedOffset*/0, NewLoc);
|
||||
//
|
||||
// Switch to the new file the way #include does.
|
||||
//
|
||||
// Note: To switch back to the main file we must consume an eof token.
|
||||
//
|
||||
SourceLocation NewLoc = m_Interpreter->getNextAvailableLoc();
|
||||
PP.EnterSourceFile(FID, /*DirLookup*/0, NewLoc);
|
||||
PP.Lex(const_cast<Token&>(P.getCurToken()));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user