From fa5788ff8dc10f36e0947757e335cd180a1a63c9 Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Wed, 31 May 2023 14:53:11 -0700 Subject: [clang][index] NFCI: Make `CXFile` a `FileEntryRef` This patch swaps out the `void *` behind `CXFile` from `FileEntry *` to `FileEntryRef::MapEntry *`. This allows us to remove some deprecated uses of `FileEntry::getName()`. Depends on D151854. Reviewed By: benlangmuir Differential Revision: https://reviews.llvm.org/D151938 --- clang/lib/Basic/Module.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'clang/lib/Basic/Module.cpp') diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 057fc77..3f9b8d0 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -271,18 +271,16 @@ OptionalDirectoryEntryRef Module::getEffectiveUmbrellaDir() const { return std::nullopt; } -void Module::addTopHeader(const FileEntry *File) { +void Module::addTopHeader(FileEntryRef File) { assert(File); TopHeaders.insert(File); } -ArrayRef Module::getTopHeaders(FileManager &FileMgr) { +ArrayRef Module::getTopHeaders(FileManager &FileMgr) { if (!TopHeaderNames.empty()) { - for (std::vector::iterator - I = TopHeaderNames.begin(), E = TopHeaderNames.end(); I != E; ++I) { - if (auto FE = FileMgr.getFile(*I)) + for (StringRef TopHeaderName : TopHeaderNames) + if (auto FE = FileMgr.getOptionalFileRef(TopHeaderName)) TopHeaders.insert(*FE); - } TopHeaderNames.clear(); } -- cgit v1.1