diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -412,9 +412,11 @@ return; } - // Get the current file lexer we're looking at. Ignore _Pragma 'files' etc. - // Mark the file as a once-only file now. - HeaderInfo.MarkFileIncludeOnce(getCurrentFileLexer()->getFileEntry()); + if (getCurrentFileLexer()->getFileEntry()) { + // Get the current file lexer we're looking at. Ignore _Pragma 'files' etc. + // Mark the file as a once-only file now. + HeaderInfo.MarkFileIncludeOnce(getCurrentFileLexer()->getFileEntry()); + } } void Preprocessor::HandlePragmaMark(Token &MarkTok) {