Skip to content

Commit 94b727f

Browse files
committed
[Dependency Scanning] Update cached batch scan compiler instances with up-to-date search paths on successive scanner invocations
To ensure they do not get stuck with stale search paths when scanning successive targets.
1 parent 2121d32 commit 94b727f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/DependencyScan/ScanDependencies.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,13 @@ forEachBatchEntry(CompilerInstance &invocationInstance,
950950
// before.
951951
pInstance = (*subInstanceMap)[entry.arguments].first.get();
952952
pCache = (*subInstanceMap)[entry.arguments].second.get();
953+
// We must update the search paths of this instance to instead reflect those of the current
954+
// invocation's.
955+
for (auto &path : invocationInstance.getASTContext().SearchPathOpts.ImportSearchPaths)
956+
pInstance->getASTContext().addSearchPath(path, false, false);
957+
for (auto &path : invocationInstance.getASTContext().SearchPathOpts.FrameworkSearchPaths)
958+
pInstance->getASTContext().addSearchPath(path.Path, true, path.IsSystem);
959+
953960
} else {
954961
// Create a new instance by the arguments and save it in the map.
955962
subInstanceMap->insert(

0 commit comments

Comments
 (0)