tapaswenipathak created this revision. tapaswenipathak added a reviewer: v.g.vassilev. tapaswenipathak added a project: clang. Herald added a project: All. tapaswenipathak requested review of this revision. Herald added a subscriber: cfe-commits.
Add check before marking file as a once-only file. Ref: https://github.com/vgvassilev/clang/commit/728e1b3286. Authored-by: Vassil Vassilev <vvasi...@cern.ch> Submitted-by: Tapasweni Pathak <tapaswenipat...@gmail.com> Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D128319 Files: clang/lib/Lex/Pragma.cpp Index: clang/lib/Lex/Pragma.cpp =================================================================== --- clang/lib/Lex/Pragma.cpp +++ 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) {
Index: clang/lib/Lex/Pragma.cpp =================================================================== --- clang/lib/Lex/Pragma.cpp +++ 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) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits