diff options
author | Ben Langmuir <blangmuir@apple.com> | 2022-11-14 14:51:54 -0800 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2022-11-15 13:59:26 -0800 |
commit | 05ec16d90deb747414c8534f98617d25d90bb714 (patch) | |
tree | cb3aec8e4662c760847ddcdef7974ab4748ca6b1 /clang/lib/Frontend/FrontendAction.cpp | |
parent | 0a33ceee0105c94060c8a6089a2e489a8a7a5cb7 (diff) | |
download | llvm-05ec16d90deb747414c8534f98617d25d90bb714.zip llvm-05ec16d90deb747414c8534f98617d25d90bb714.tar.gz llvm-05ec16d90deb747414c8534f98617d25d90bb714.tar.bz2 |
[clang][deps] Avoid leaking modulemap paths across unrelated imports
Use a FileEntryRef when retrieving modulemap paths in the scanner so
that we use a path compatible with the original module import, rather
than a FileEntry which can allow unrelated modules to leak paths into
how we build a module due to FileManager mutating the path.
Note: the current change prevents an "unrelated" path, but does not
change how VFS mapped paths are handled (which would be calling
getNameAsRequested) nor canonicalize the path.
Differential Revision: https://reviews.llvm.org/D137989
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 45f04ea..76ef0cb 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -638,11 +638,10 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, if (&MF != &PrimaryModule) CI.getFrontendOpts().ModuleFiles.push_back(MF.FileName); - ASTReader->visitTopLevelModuleMaps( - PrimaryModule, [&](const FileEntry *FE) { - CI.getFrontendOpts().ModuleMapFiles.push_back( - std::string(FE->getName())); - }); + ASTReader->visitTopLevelModuleMaps(PrimaryModule, [&](FileEntryRef FE) { + CI.getFrontendOpts().ModuleMapFiles.push_back( + std::string(FE.getName())); + }); } // Set up the input file for replay purposes. |