[PATCH] D127647: [clang][lex] NFCI: Use FileEntryRef in ModuleMap::{load,lookup}ModuleMap()
Ben Barham via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 13 09:38:30 PDT 2022
bnbarham accepted this revision.
bnbarham added a comment.
This revision is now accepted and ready to land.
Few small comments, LGTM otherwise.
================
Comment at: clang/include/clang/Lex/HeaderSearch.h:627
/// Try to find a module map file in the given directory, returning
/// \c nullptr if none is found.
+ Optional<FileEntryRef> lookupModuleMapFile(const DirectoryEntry *Dir,
----------------
================
Comment at: clang/lib/Frontend/FrontendAction.cpp:444
FileID ModuleMapID = SrcMgr.getMainFileID();
- const FileEntry *ModuleMap = SrcMgr.getFileEntryForID(ModuleMapID);
+ Optional<FileEntryRef> ModuleMap = SrcMgr.getFileEntryRefForID(ModuleMapID);
----------------
The empty case isn't checked as far as I can tell. The null case wasn't either, but seems like we should just `return true`?
================
Comment at: clang/lib/Lex/HeaderSearch.cpp:1713
+ if (auto F = FileMgr.getOptionalFileRef(ModuleMapFileName))
return *F;
----------------
Nitpick: could just return `F` directly in the 3 ifs here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127647/new/
https://reviews.llvm.org/D127647
More information about the cfe-commits
mailing list