Skip to content

Commit 4a5d041

Browse files
committed
FineModuleTrace: reposition the currently ObjC message specific trace files to be a more general purposed file for tracing fine-grained dependencies. NFC
1 parent 51a68ec commit 4a5d041

File tree

10 files changed

+29
-28
lines changed

10 files changed

+29
-28
lines changed

include/swift/Basic/FileTypes.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ TYPE("tbd", TBD, "tbd", "")
7373
// engineers can see more details on the "Swift module traces" page in the
7474
// Swift section of the internal wiki.
7575
TYPE("module-trace", ModuleTrace, "trace.json", "")
76-
TYPE("module-objc-trace", ModuleObjCTrace, "", "")
76+
TYPE("fine-module-trace", FineModuleTrace, "", "")
7777

7878
// Complete dependency information for the given Swift files as JSON.
7979
TYPE("json-dependencies", JSONDependencies, "dependencies.json", "")

include/swift/Basic/SupplementaryOutputPaths.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ OUTPUT(FixItsOutputPath, TY_SwiftFixIt)
106106
/// to each .swiftmodule that was loaded while building module NAME for target
107107
/// TARGET. This format is subject to arbitrary change, however.
108108
OUTPUT(LoadedModuleTracePath, TY_ModuleTrace)
109-
OUTPUT(ModuleObjCTracePath, TY_ModuleObjCTrace)
109+
OUTPUT(FineModuleTracePath, TY_FineModuleTrace)
110110

111111
/// The path to which we should output a TBD file.
112112
///

include/swift/Frontend/InputFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ class InputFile final {
133133
StringRef getLoadedModuleTracePath() const {
134134
return getPrimarySpecificPaths().SupplementaryOutputs.LoadedModuleTracePath;
135135
}
136-
StringRef getModuleObjCTracePath() const {
137-
return getPrimarySpecificPaths().SupplementaryOutputs.ModuleObjCTracePath;
136+
StringRef getFineModuleTracePath() const {
137+
return getPrimarySpecificPaths().SupplementaryOutputs.FineModuleTracePath;
138138
}
139139
StringRef getSerializedDiagnosticsPath() const {
140140
return getPrimarySpecificPaths().SupplementaryOutputs

lib/Basic/FileTypes.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ bool file_types::isTextual(ID Id) {
105105
case file_types::TY_ImportedModules:
106106
case file_types::TY_TBD:
107107
case file_types::TY_ModuleTrace:
108-
case file_types::TY_ModuleObjCTrace:
108+
case file_types::TY_FineModuleTrace:
109109
case file_types::TY_YAMLOptRecord:
110110
case file_types::TY_SwiftModuleInterfaceFile:
111111
case file_types::TY_PrivateSwiftModuleInterfaceFile:
@@ -187,7 +187,7 @@ bool file_types::isAfterLLVM(ID Id) {
187187
case file_types::TY_Remapping:
188188
case file_types::TY_IndexData:
189189
case file_types::TY_ModuleTrace:
190-
case file_types::TY_ModuleObjCTrace:
190+
case file_types::TY_FineModuleTrace:
191191
case file_types::TY_YAMLOptRecord:
192192
case file_types::TY_BitstreamOptRecord:
193193
case file_types::TY_SwiftModuleInterfaceFile:
@@ -251,7 +251,7 @@ bool file_types::isPartOfSwiftCompilation(ID Id) {
251251
case file_types::TY_Remapping:
252252
case file_types::TY_IndexData:
253253
case file_types::TY_ModuleTrace:
254-
case file_types::TY_ModuleObjCTrace:
254+
case file_types::TY_FineModuleTrace:
255255
case file_types::TY_YAMLOptRecord:
256256
case file_types::TY_BitstreamOptRecord:
257257
case file_types::TY_JSONDependencies:
@@ -314,7 +314,7 @@ bool file_types::isProducedFromDiagnostics(ID Id) {
314314
case file_types::TY_Remapping:
315315
case file_types::TY_IndexData:
316316
case file_types::TY_ModuleTrace:
317-
case file_types::TY_ModuleObjCTrace:
317+
case file_types::TY_FineModuleTrace:
318318
case file_types::TY_YAMLOptRecord:
319319
case file_types::TY_BitstreamOptRecord:
320320
case file_types::TY_JSONDependencies:

lib/Driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,7 @@ void Driver::buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
16911691
case file_types::TY_PCH:
16921692
case file_types::TY_ImportedModules:
16931693
case file_types::TY_ModuleTrace:
1694-
case file_types::TY_ModuleObjCTrace:
1694+
case file_types::TY_FineModuleTrace:
16951695
case file_types::TY_YAMLOptRecord:
16961696
case file_types::TY_BitstreamOptRecord:
16971697
case file_types::TY_SwiftModuleInterfaceFile:

lib/Driver/ToolChains.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ const char *ToolChain::JobContext::computeFrontendModeForCompile() const {
763763
case file_types::TY_SwiftDeps:
764764
case file_types::TY_ExternalSwiftDeps:
765765
case file_types::TY_ModuleTrace:
766-
case file_types::TY_ModuleObjCTrace:
766+
case file_types::TY_FineModuleTrace:
767767
case file_types::TY_TBD:
768768
case file_types::TY_YAMLOptRecord:
769769
case file_types::TY_BitstreamOptRecord:
@@ -1039,7 +1039,7 @@ ToolChain::constructInvocation(const BackendJobAction &job,
10391039
case file_types::TY_ExternalSwiftDeps:
10401040
case file_types::TY_Remapping:
10411041
case file_types::TY_ModuleTrace:
1042-
case file_types::TY_ModuleObjCTrace:
1042+
case file_types::TY_FineModuleTrace:
10431043
case file_types::TY_YAMLOptRecord:
10441044
case file_types::TY_BitstreamOptRecord:
10451045
case file_types::TY_SwiftModuleInterfaceFile:

lib/Frontend/ArgsToFrontendOutputsConverter.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,18 +456,19 @@ SupplementaryOutputPathsComputer::computeOutputPathsForOneInput(
456456
defaultSupplementaryOutputPathExcludingExtension);
457457

458458
// We piggy-back on the loadedModuleTracePath to decide (1) whether
459-
// to emit the ObjC Trace file, and (2) where to emit the objc trace file if
460-
// the path isn't explicitly given by SWIFT_COMPILER_OBJC_MESSAGE_TRACE_PATH.
459+
// to emit the fine module Trace file, and (2) where to emit the fine module
460+
// trace file if the path isn't explicitly given by
461+
// SWIFT_COMPILER_OBJC_MESSAGE_TRACE_PATH.
461462
// FIXME: we probably need to move this to a frontend argument.
462-
llvm::SmallString<128> ModuleObjCTracePath;
463+
llvm::SmallString<128> FineModuleTracePath;
463464
if (!loadedModuleTracePath.empty()) {
464465
if (const char *P = ::getenv("SWIFT_COMPILER_OBJC_MESSAGE_TRACE_PATH")) {
465466
StringRef FilePath = P;
466-
llvm::sys::path::append(ModuleObjCTracePath, FilePath);
467+
llvm::sys::path::append(FineModuleTracePath, FilePath);
467468
} else {
468-
llvm::sys::path::append(ModuleObjCTracePath, loadedModuleTracePath);
469-
llvm::sys::path::remove_filename(ModuleObjCTracePath);
470-
llvm::sys::path::append(ModuleObjCTracePath,
469+
llvm::sys::path::append(FineModuleTracePath, loadedModuleTracePath);
470+
llvm::sys::path::remove_filename(FineModuleTracePath);
471+
llvm::sys::path::append(FineModuleTracePath,
471472
".SWIFT_FINE_DEPENDENCY_TRACE.json");
472473
}
473474
}
@@ -537,7 +538,7 @@ SupplementaryOutputPathsComputer::computeOutputPathsForOneInput(
537538
sop.SerializedDiagnosticsPath = serializedDiagnosticsPath;
538539
sop.FixItsOutputPath = fixItsOutputPath;
539540
sop.LoadedModuleTracePath = loadedModuleTracePath;
540-
sop.ModuleObjCTracePath = ModuleObjCTracePath.str().str();
541+
sop.FineModuleTracePath = FineModuleTracePath.str().str();
541542
sop.TBDPath = tbdPath;
542543
sop.ModuleInterfaceOutputPath = ModuleInterfaceOutputPath;
543544
sop.PrivateModuleInterfaceOutputPath = PrivateModuleInterfaceOutputPath;

lib/FrontendTool/Dependencies.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ bool emitLoadedModuleTraceIfNeeded(ModuleDecl *mainModule,
3232
const FrontendOptions &opts,
3333
const InputFile &input);
3434

35-
bool emitObjCMessageSendTraceIfNeeded(ModuleDecl *mainModule,
36-
const FrontendOptions &opts);
35+
bool emitFineModuleTraceIfNeeded(ModuleDecl *mainModule,
36+
const FrontendOptions &opts);
3737

3838
} // end namespace swift
3939

lib/FrontendTool/FrontendTool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ static void performEndOfPipelineActions(CompilerInstance &Instance) {
10011001
Instance.getMainModule(), Instance.getDependencyTracker(), opts);
10021002

10031003
dumpAPIIfNeeded(Instance);
1004-
swift::emitObjCMessageSendTraceIfNeeded(Instance.getMainModule(), opts);
1004+
swift::emitFineModuleTraceIfNeeded(Instance.getMainModule(), opts);
10051005
}
10061006

10071007
// Contains the hadError checks internally, we still want to output the

lib/FrontendTool/LoadedModuleTrace.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,8 @@ class ObjcMethodReferenceCollector: public SourceEntityWalker {
853853
}
854854
};
855855

856-
static void createObjCMessageTraceFile(const InputFile &input, ModuleDecl *MD) {
857-
StringRef tracePath = input.getModuleObjCTracePath();
856+
static void createFineModuleTraceFile(const InputFile &input, ModuleDecl *MD) {
857+
StringRef tracePath = input.getFineModuleTracePath();
858858
if (tracePath.empty()) {
859859
// we basically rely on the passing down of module trace file path
860860
// as an indicator that this job needs to emit an ObjC message trace file.
@@ -893,7 +893,7 @@ static void createObjCMessageTraceFile(const InputFile &input, ModuleDecl *MD) {
893893
return;
894894
}
895895
ObjcMethodReferenceCollector collector(MD);
896-
for (auto *SF : filesToWalk) {
896+
for (auto *SF: filesToWalk) {
897897
collector.setFileBeforeVisiting(SF);
898898
collector.walk(*SF);
899899
}
@@ -915,14 +915,14 @@ static void createObjCMessageTraceFile(const InputFile &input, ModuleDecl *MD) {
915915
}
916916
}
917917

918-
bool swift::emitObjCMessageSendTraceIfNeeded(ModuleDecl *mainModule,
919-
const FrontendOptions &opts) {
918+
bool swift::emitFineModuleTraceIfNeeded(ModuleDecl *mainModule,
919+
const FrontendOptions &opts) {
920920
ASTContext &ctxt = mainModule->getASTContext();
921921
assert(!ctxt.hadError() &&
922922
"We should've already exited earlier if there was an error.");
923923

924924
opts.InputsAndOutputs.forEachInput([&](const InputFile &input) {
925-
createObjCMessageTraceFile(input, mainModule);
925+
createFineModuleTraceFile(input, mainModule);
926926
return true;
927927
});
928928
return false;

0 commit comments

Comments
 (0)