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

2022-11-03 Thread Ben Barham via Phabricator via cfe-commits
bnbarham added inline comments. Comment at: clang/include/clang/Basic/SourceManager.h:147-163 /// Indicates whether the buffer itself was provided to override /// the actual file contents. /// /// When true, the original entry may be a virtual file that does not //

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

2022-11-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
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

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

2022-11-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added inline comments. Comment at: clang/include/clang/Basic/SourceManager.h:261-263 + /// FIXME: Make non-optional using a virtual file as needed, remove \c + /// Filename and use \c OrigEntry.getNameAsRequested() instead. + OptionalFileEntryRefDegradesToFileEntryP

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

2022-11-02 Thread Ben Langmuir via Phabricator via cfe-commits
benlangmuir added a comment. Thanks for the timely review! > the DenseMaps that need this unique-by-FileEntry* behaviour should probably > be the ones using a custom DenseMapInfo. Yeah, that's the way I'm currently leaning. Make the default for `DenseMap` and `==` be path equality and have a

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

2022-11-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added inline comments. Comment at: clang/include/clang/Basic/SourceManager.h:652-662 + llvm::DenseMap + NamedFileInfos; + /// Memoized information about all of the files tracked by this /// SourceManager. /// It feels expensive to have b

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

2022-11-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
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

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

2022-11-02 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment. > Consider making the FileEntryRef changes here the default -- it doesn't make > sense to me that FileEntryRef == or DenseMap would match FileEntry pointer > semantics instead of filename semantics. Yeah, that was something I added, and I agree it's unfortunate / har

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

2022-11-02 Thread Ben Langmuir via Phabricator via cfe-commits
benlangmuir created this revision. Herald added a project: All. benlangmuir requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. When including a header, store the filename per include (per FileInfo) rather than storing it once in the ContentCac