[PATCH] D135220: [clang] Update ModuleMap::getModuleMapFile* to use FileEntryRef

Ben Langmuir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 15:17:52 PDT 2022


benlangmuir created this revision.
benlangmuir added reviewers: jansvoboda11, bnbarham.
Herald added a subscriber: arphaman.
Herald added a project: All.
benlangmuir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Update `SourceManager::ContentCache::OrigEntry` to keep the original `FileEntryRef`, and use that to enable `ModuleMap::getModuleMapFile*` to return the original `FileEntryRef`. This change should be NFC for most users of `SourceManager::ContentCache`, but it could affect behaviour for users of `getNameAsRequested` such as in `compileModuleImpl`. I have not found a way to detect that difference without additional functional changes, so there is no test change here.

Note: this should fix the Windows failure on https://reviews.llvm.org/D134923 which was caused by an incidental `getFile` call mutating `LastRef` on the `FileEntry`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135220

Files:
  clang/include/clang/Basic/FileEntry.h
  clang/include/clang/Basic/SourceManager.h
  clang/include/clang/Lex/ModuleMap.h
  clang/lib/Basic/SourceManager.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Lex/HeaderSearch.cpp
  clang/lib/Lex/ModuleMap.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
  clang/tools/libclang/CIndexInclusionStack.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135220.465191.patch
Type: text/x-patch
Size: 18216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221004/71a661c6/attachment-0001.bin>


More information about the cfe-commits mailing list