diff options
author | Richard Howell <rhow@fb.com> | 2023-01-18 14:58:15 -0800 |
---|---|---|
committer | Richard Howell <rhow@fb.com> | 2023-01-20 07:23:11 -0800 |
commit | 75fbb5d2238f1824f03d205b699061a115d5effc (patch) | |
tree | a84325c4a57e4284d5720446e99cbe2dddb8a7ef /clang/lib/Frontend/FrontendAction.cpp | |
parent | 9d4f1a9eff27716069dc6a2d991baa228c197b85 (diff) | |
download | llvm-75fbb5d2238f1824f03d205b699061a115d5effc.zip llvm-75fbb5d2238f1824f03d205b699061a115d5effc.tar.gz llvm-75fbb5d2238f1824f03d205b699061a115d5effc.tar.bz2 |
[clang][nfc] refactor Module::Header to use OptionalFileEntryRef
Refactor the `Module::Header` class to use an `OptionalFileEntryRef`
instead of a `FileEntry*`. This is preparation for refactoring the
`TopHeaderNames` to use `FileEntryRef` so that we preserve the
lookup path of the headers when serializing.
This is mostly based on https://reviews.llvm.org/D90497
Reviewed By: jansvoboda11
Differential Revision: https://reviews.llvm.org/D142113
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 6ec6fa0..1e27664 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -12,6 +12,7 @@ #include "clang/AST/DeclGroup.h" #include "clang/Basic/Builtins.h" #include "clang/Basic/DiagnosticOptions.h" +#include "clang/Basic/FileEntry.h" #include "clang/Basic/LangStandard.h" #include "clang/Basic/Sarif.h" #include "clang/Frontend/ASTUnit.h" @@ -376,7 +377,9 @@ static std::error_code collectModuleHeaderIncludes( llvm::sys::path::native(UmbrellaDir.Entry->getName(), DirNative); llvm::vfs::FileSystem &FS = FileMgr.getVirtualFileSystem(); - SmallVector<std::pair<std::string, const FileEntry *>, 8> Headers; + SmallVector< + std::pair<std::string, OptionalFileEntryRefDegradesToFileEntryPtr>, 8> + Headers; for (llvm::vfs::recursive_directory_iterator Dir(FS, DirNative, EC), End; Dir != End && !EC; Dir.increment(EC)) { // Check whether this entry has an extension typically associated with @@ -386,7 +389,7 @@ static std::error_code collectModuleHeaderIncludes( .Default(false)) continue; - auto Header = FileMgr.getFile(Dir->path()); + auto Header = FileMgr.getOptionalFileRef(Dir->path()); // FIXME: This shouldn't happen unless there is a file system race. Is // that worth diagnosing? if (!Header) |