[PATCH] D128319: Survive #pragma once from virtual file.
Tapasweni Pathak via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 21 20:19:55 PDT 2022
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 <vvasilev at cern.ch>
Submitted-by: Tapasweni Pathak <tapaswenipathak at 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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128319.438899.patch
Type: text/x-patch
Size: 716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220622/9b040237/attachment.bin>
More information about the cfe-commits
mailing list