[PATCH] D137304: [clang] Store filename per include instead of mutating filename

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 18:35:59 PDT 2022


dexonsmith added inline comments.


================
Comment at: clang/include/clang/Basic/SourceManager.h:135-139
   /// References the file which the contents were actually loaded from.
   ///
   /// Can be different from 'Entry' if we overridden the contents of one file
   /// with the contents of another file.
   const FileEntry *ContentsEntry;
----------------
benlangmuir wrote:
> dexonsmith wrote:
> > It's possible this could be factored out as a follow-up, and/or moved up to the Named ContentCache level. (Not sure... asking a question really...)
> I think this belongs here. It is used to lazily get the contents of the file (see the getBuffer functions).
You're right. I wonder what if that laziness is inherently load-bearing. Seems odd that clang would want to create a FileID without very quickly trying to open it. But maybe that's important somewhere/somehow. Certainly off-topic for this patch though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137304



More information about the cfe-commits mailing list