aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-02-01 05:34:02 +0000
committerChris Lattner <sabre@nondot.org>2008-02-01 05:34:02 +0000
commit9415a0cc93117b69add4e1dc0f11146f3479ee1a (patch)
tree6fbb814cc29574c3e58ae8acf161afb8751db3b4
parentf7682b039609e1394f0f711de11ab3fb640289f2 (diff)
Fix PR1969. stdin has no FileEntry.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46629 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Lex/HeaderSearch.cpp2
-rw-r--r--Lex/Preprocessor.cpp17
2 files changed, 11 insertions, 8 deletions
diff --git a/Lex/HeaderSearch.cpp b/Lex/HeaderSearch.cpp
index e4f7aeb806..bd36f35d49 100644
--- a/Lex/HeaderSearch.cpp
+++ b/Lex/HeaderSearch.cpp
@@ -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;
diff --git a/Lex/Preprocessor.cpp b/Lex/Preprocessor.cpp
index 34b5fe2183..a73757f1b5 100644
--- a/Lex/Preprocessor.cpp
+++ b/Lex/Preprocessor.cpp
@@ -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;
}
}