================
@@ -739,6 +748,12 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module 
*M) {
   MDC.ScanInstance.getASTReader()->visitInputFileInfos(
       *MF, /*IncludeSystem=*/true,
       [&](const serialization::InputFileInfo &IFI, bool IsSystem) {
+        if (MD.IsInSysroot) {
+          auto FullFilePath = ASTReader::ResolveImportedPath(
+              PathBuf, IFI.UnresolvedImportedFilename, MF->BaseDirectory);
+          MD.IsInSysroot = FullFilePath->starts_with(CurrSysroot);
----------------
benlangmuir wrote:

Do you mean `starts_with`? That one looks like it has the same issue 😬 In fact 
I see in the `replace_path_prefix` documentation it claims the following 
behaviour
```
/oldfoo, /old, /new => /oldfoo
```

but the unit test for this function actually has an equivalent case and the 
behaviour is different `/oldnew/foo, /old, /new => /newnew/foo` specifically 
because `starts_with` is wrong.

https://github.com/llvm/llvm-project/pull/130634
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to