ModuleObjCTrace/CAS: compute objc trace file paths via the canoical supplementary output paths computation

CAS support in compiler relies on supplementary paths to decide the mapping between input and output files. Therefore, we
have to compute the paths of the module ObjC trace files in this canonical place to have CAS support for
this newly added ObjC message trace files.
This commit is contained in:
Xi Ge
2024-11-20 08:49:04 -08:00
parent fc1dac7e77
commit 51a68ecdd1
8 changed files with 32 additions and 10 deletions

View File

@@ -854,7 +854,8 @@ public:
};
static void createObjCMessageTraceFile(const InputFile &input, ModuleDecl *MD) {
if (input.getLoadedModuleTracePath().empty()) {
StringRef tracePath = input.getModuleObjCTracePath();
if (tracePath.empty()) {
// we basically rely on the passing down of module trace file path
// as an indicator that this job needs to emit an ObjC message trace file.
// FIXME: add a separate swift-frontend flag for ObjC message trace path
@@ -882,15 +883,6 @@ static void createObjCMessageTraceFile(const InputFile &input, ModuleDecl *MD) {
if (filesToWalk.empty()) {
return;
}
llvm::SmallString<128> tracePath;
if (const char *P = ::getenv("SWIFT_COMPILER_OBJC_MESSAGE_TRACE_PATH")) {
StringRef FilePath = P;
llvm::sys::path::append(tracePath, FilePath);
} else {
llvm::sys::path::append(tracePath, input.getLoadedModuleTracePath());
llvm::sys::path::remove_filename(tracePath);
llvm::sys::path::append(tracePath, ".SWIFT_FINE_DEPENDENCY_TRACE.json");
}
// Write output via atomic append.
llvm::vfs::OutputConfig config;
config.setAppend().setAtomicWrite();