[PATCH] D127379: [Lex] Keep track of skipped preprocessor blocks and advance the lexer directly if they are revisited

Ben Langmuir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 13 10:08:10 PDT 2022


benlangmuir added inline comments.


================
Comment at: clang/lib/Lex/PPDirectives.cpp:514
+      BeginPtr = PP.CurLexer->getBufferLocation();
+      SkipRangePtr = &PP.RecordedSkippedRanges[BeginPtr];
+      if (*SkipRangePtr) {
----------------
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.


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