[PATCH] D127379: [Lex] Keep track of skipped preprocessor blocks and advance the lexer directly if they are revisited
Argyrios Kyrtzidis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 13 13:56:50 PDT 2022
akyrtzi marked an inline comment as done.
akyrtzi added inline comments.
================
Comment at: clang/lib/Lex/PPDirectives.cpp:514
+ BeginPtr = PP.CurLexer->getBufferLocation();
+ SkipRangePtr = &PP.RecordedSkippedRanges[BeginPtr];
+ if (*SkipRangePtr) {
----------------
akyrtzi wrote:
> benlangmuir wrote:
> > Storing this pointer is only safe as long as `SkipExcludedConditionalBlock` can never be called recursively, since any modification to the `DenseMap` can invalidate this pointer. Is there some cheap way to assert that? If not, maybe we should do the lookup again in `endLexPass`, which would always be correct.
> Good point! I can add a `bool` to assert that `SkipExcludedConditionalBlock` is not recursively called.
Done 👍
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127379/new/
https://reviews.llvm.org/D127379
More information about the cfe-commits
mailing list