[PATCH] D114095: [clang][lex] Include tracking: simplify and move to preprocessor
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 22 00:09:10 PST 2021
jansvoboda11 added inline comments.
================
Comment at: clang/lib/Serialization/ASTWriter.cpp:873
RECORD(PP_TOKEN);
+ RECORD(PP_INCLUDED_FILES);
----------------
vsapsai wrote:
> I believe `PP_INCLUDED_FILES` is located in `AST_BLOCK`. Yes, you write it in `ASTWriter::WritePreprocessor` but after `Stream.ExitBlock()` together with `MACRO_OFFSET`. And then you read it in `ASTReader::ReadASTBlock` at the top level and not inside `case PREPROCESSOR_BLOCK_ID` or from `ModuleFile::MacroCursor`.
That's right. This is modeled after `PP_CONDITIONAL_STACK` and `PP_COUNTER_VALUE`.
The problem is that the whole `PREPROCESSOR_BLOCK_ID` is treated as "macros only" block that's not being split into individual records right away and is instead deserialized lazily in `ReadMacroRecord`, `ReadDefinedMacros`, `resolvePendingMacro`. I think this should be fixed eventually, but I didn't want to expand the scope of my changes, since it's already somewhat complex already.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114095/new/
https://reviews.llvm.org/D114095
More information about the cfe-commits
mailing list