================
@@ -1896,6 +1916,77 @@ static bool suggestModule(HeaderSearch &HS,
ModuleMap::KnownHeader Module,
return true;
}
+void HeaderSearch::diagnoseUncoveredSymlink(FileEntryRef File,
+ ModuleMap::KnownHeader &Module,
+ const DirectoryEntry *Root) {
+ if (!Module)
+ return;
+
+ if (!HSOpts.ImplicitModuleMaps || Module.getModule()->isPartOfFramework() ||
+ !Module.getModule()->isModuleMapModule())
+ return;
+
+ if (Diags.isIgnored(diag::warn_mmap_deprecated_symlink_to_modular_header,
+ Module.getModule()->DefinitionLoc))
+ return;
+
+ if (File.isDeviceFile() || File.isNamedPipe())
+ return;
+
+ llvm::SmallString<128> AbsPath(File.getName());
+ FileMgr.makeAbsolutePath(AbsPath);
+ llvm::sys::path::remove_dots(AbsPath, /*remove_dot_dot=*/true);
+
+ // NOTE: This path may be redirected, LLVM's VFS does not model symlinks, so
+ // it's possible this fails. The diagnostic is worded as such.
+ llvm::SmallString<128> LinkTarget;
+ if (llvm::sys::fs::readlink(AbsPath, LinkTarget))
+ return;
----------------
jansvoboda11 wrote:
We chatted offline and I think this is fine for the time being as a best-effort
approach.
https://github.com/llvm/llvm-project/pull/188059
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits