mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +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:
@@ -73,7 +73,7 @@ public:
|
||||
auto OutputType = ProducingInput->second.second;
|
||||
|
||||
// Uncached output kind.
|
||||
if (file_types::isProducedFromDiagnostics(OutputType))
|
||||
if (!isStoredDirectly(OutputType))
|
||||
return std::make_unique<llvm::vfs::NullOutputFileImpl>();
|
||||
|
||||
return std::make_unique<SwiftCASOutputFile>(
|
||||
@@ -115,6 +115,11 @@ SwiftCASOutputBackend::SwiftCASOutputBackend(
|
||||
|
||||
SwiftCASOutputBackend::~SwiftCASOutputBackend() { delete &Impl; }
|
||||
|
||||
bool SwiftCASOutputBackend::isStoredDirectly(file_types::ID Kind) {
|
||||
return !file_types::isProducedFromDiagnostics(Kind) &&
|
||||
Kind != file_types::TY_Dependencies;
|
||||
}
|
||||
|
||||
IntrusiveRefCntPtr<OutputBackend> SwiftCASOutputBackend::cloneImpl() const {
|
||||
return makeIntrusiveRefCnt<SwiftCASOutputBackend>(
|
||||
Impl.CAS, Impl.Cache, Impl.BaseKey, Impl.InputsAndOutputs, Impl.Action);
|
||||
@@ -142,6 +147,18 @@ Error SwiftCASOutputBackend::storeCachedDiagnostics(unsigned InputIndex,
|
||||
file_types::ID::TY_CachedDiagnostics);
|
||||
}
|
||||
|
||||
Error SwiftCASOutputBackend::storeMakeDependenciesFile(StringRef OutputFilename,
|
||||
llvm::StringRef Bytes) {
|
||||
auto Input = Impl.OutputToInputMap.find(OutputFilename);
|
||||
if (Input == Impl.OutputToInputMap.end())
|
||||
return llvm::createStringError("InputIndex for output file not found!");
|
||||
auto InputIndex = Input->second.first;
|
||||
assert(Input->second.second == file_types::TY_Dependencies &&
|
||||
"wrong output type");
|
||||
return storeImpl(OutputFilename, Bytes, InputIndex,
|
||||
file_types::TY_Dependencies);
|
||||
}
|
||||
|
||||
Error SwiftCASOutputBackend::storeMCCASObjectID(StringRef OutputFilename,
|
||||
llvm::cas::CASID ID) {
|
||||
auto Input = Impl.OutputToInputMap.find(OutputFilename);
|
||||
|
||||
Reference in New Issue
Block a user