From 75fbb5d2238f1824f03d205b699061a115d5effc Mon Sep 17 00:00:00 2001 From: Richard Howell Date: Wed, 18 Jan 2023 14:58:15 -0800 Subject: [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 --- clang/lib/Frontend/FrontendAction.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'clang/lib/Frontend/FrontendAction.cpp') 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, 8> Headers; + SmallVector< + std::pair, 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) -- cgit v1.1