[PATCH] D158572: [clang][modules] Use relative offsets for input files

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 23 12:30:22 PDT 2023


jansvoboda11 added inline comments.


================
Comment at: clang/include/clang/Serialization/ModuleFile.h:249
+  /// Absolute offset of the start of the input-files block.
+  uint64_t InputFilesOffsetBase;
+
----------------
benlangmuir wrote:
> Doesn't `InputFilesCursor` already know where the input files block starts?
I think it does. We should be able to remove this and always call `InputFilesCursor::GetCurrentBitNo()` at the start. I implemented it this way because it's consistent with the existing pattern: `SLocEntryCursor`/`SourceManagerBlockStartOffset`, `MacroCursor`/`MacroOffsetsBase`, `DeclsCursor`/`DeclsBlockStartOffset`.

LMK if you feel strongly about it and I can look into getting rid of the extra offset base members.


================
Comment at: clang/lib/Serialization/ASTReader.cpp:5334
   BitstreamCursor InputFilesCursor;
+  uint64_t InputFilesOffsetBase;
 
----------------
benlangmuir wrote:
> We should initialize this to something - either 0 or maybe ~0 so it will be invalid?
Good point, I'll do that along with initializing the member variable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158572/new/

https://reviews.llvm.org/D158572



More information about the cfe-commits mailing list