Fix PR1969. stdin has no FileEntry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46629 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2008-02-01 05:34:02 +00:00
Родитель f7682b0396
Коммит 9415a0cc93
2 изменённых файлов: 11 добавлений и 8 удалений

Просмотреть файл

@ -293,6 +293,8 @@ const FileEntry *HeaderSearch::
LookupSubframeworkHeader(const char *FilenameStart,
const char *FilenameEnd,
const FileEntry *ContextFileEnt) {
assert(ContextFileEnt && "No context file?");
// Framework names must have a '/' in the filename. Find it.
const char *SlashPos = std::find(FilenameStart, FilenameEnd, '/');
if (SlashPos == FilenameEnd) return 0;

Просмотреть файл

@ -500,19 +500,20 @@ const FileEntry *Preprocessor::LookupFile(const char *FilenameStart,
// to one of the headers on the #include stack. Walk the list of the current
// headers on the #include stack and pass them to HeaderInfo.
if (CurLexer && !CurLexer->Is_PragmaLexer) {
CurFileEnt = SourceMgr.getFileEntryForLoc(CurLexer->getFileLoc());
if ((FE = HeaderInfo.LookupSubframeworkHeader(FilenameStart, FilenameEnd,
CurFileEnt)))
return FE;
if ((CurFileEnt = SourceMgr.getFileEntryForLoc(CurLexer->getFileLoc())))
if ((FE = HeaderInfo.LookupSubframeworkHeader(FilenameStart, FilenameEnd,
CurFileEnt)))
return FE;
}
for (unsigned i = 0, e = IncludeMacroStack.size(); i != e; ++i) {
IncludeStackInfo &ISEntry = IncludeMacroStack[e-i-1];
if (ISEntry.TheLexer && !ISEntry.TheLexer->Is_PragmaLexer) {
CurFileEnt = SourceMgr.getFileEntryForLoc(ISEntry.TheLexer->getFileLoc());
if ((FE = HeaderInfo.LookupSubframeworkHeader(FilenameStart, FilenameEnd,
CurFileEnt)))
return FE;
if ((CurFileEnt =
SourceMgr.getFileEntryForLoc(ISEntry.TheLexer->getFileLoc())))
if ((FE = HeaderInfo.LookupSubframeworkHeader(FilenameStart,
FilenameEnd, CurFileEnt)))
return FE;
}
}