mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CAS] Full support for make-style dependencies file caching hit
Fully support make-style `.d` dependencies file output by making following improvements: * All correct dependency file render when cache hit for a different output file location. The dependency file should list the correct output path, not the stale output path for the initial compilation * When enable a path prefix mapper to canonicalize the path, the dependency file should render the input file correctly as the input file path on disk. rdar://132250067
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
#include "swift/Frontend/CompileJobCacheKey.h"
|
||||
#include "swift/Frontend/DiagnosticHelper.h"
|
||||
#include "swift/Frontend/Frontend.h"
|
||||
#include "swift/Frontend/MakeStyleDependencies.h"
|
||||
#include "swift/Frontend/ModuleInterfaceLoader.h"
|
||||
#include "swift/Frontend/ModuleInterfaceSupport.h"
|
||||
#include "swift/IRGen/TBDGen.h"
|
||||
@@ -107,15 +108,13 @@ static std::string displayName(StringRef MainExecutablePath) {
|
||||
return Name;
|
||||
}
|
||||
|
||||
static void emitMakeDependenciesIfNeeded(DiagnosticEngine &diags,
|
||||
DependencyTracker *depTracker,
|
||||
const FrontendOptions &opts,
|
||||
llvm::vfs::OutputBackend &backend) {
|
||||
opts.InputsAndOutputs.forEachInputProducingSupplementaryOutput(
|
||||
[&](const InputFile &f) -> bool {
|
||||
return swift::emitMakeDependenciesIfNeeded(diags, depTracker, opts, f,
|
||||
backend);
|
||||
});
|
||||
static void emitMakeDependenciesIfNeeded(CompilerInstance &instance) {
|
||||
instance.getInvocation()
|
||||
.getFrontendOptions()
|
||||
.InputsAndOutputs.forEachInputProducingSupplementaryOutput(
|
||||
[&](const InputFile &f) -> bool {
|
||||
return swift::emitMakeDependenciesIfNeeded(instance, f);
|
||||
});
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1056,9 +1055,7 @@ static void performEndOfPipelineActions(CompilerInstance &Instance) {
|
||||
emitSwiftdepsForAllPrimaryInputsIfNeeded(Instance);
|
||||
|
||||
// Emit Make-style dependencies.
|
||||
emitMakeDependenciesIfNeeded(Instance.getDiags(),
|
||||
Instance.getDependencyTracker(), opts,
|
||||
Instance.getOutputBackend());
|
||||
emitMakeDependenciesIfNeeded(Instance);
|
||||
|
||||
// Emit extracted constant values for every file in the batch
|
||||
emitConstValuesForAllPrimaryInputsIfNeeded(Instance);
|
||||
@@ -1322,7 +1319,7 @@ static bool tryReplayCompilerResults(CompilerInstance &Instance) {
|
||||
bool replayed = replayCachedCompilerOutputs(
|
||||
Instance.getObjectStore(), Instance.getActionCache(),
|
||||
*Instance.getCompilerBaseKey(), Instance.getDiags(),
|
||||
Instance.getInvocation().getFrontendOptions().InputsAndOutputs, *CDP,
|
||||
Instance.getInvocation().getFrontendOptions(), *CDP,
|
||||
Instance.getInvocation().getCASOptions().EnableCachingRemarks,
|
||||
Instance.getInvocation().getIRGenOptions().UseCASBackend);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user