Cosmetic cleanups

This commit is contained in:
David Ungar
2019-01-30 17:16:49 -08:00
parent 4bd712731c
commit 2f65ac3735
11 changed files with 32 additions and 27 deletions

View File

@@ -297,8 +297,8 @@ namespace swift {
/// To mimic existing system, set to false.
/// To experiment with including file-private and private dependency info,
/// set to true;
bool ExperimentalDependenciesIncludePrivateDeps = false;
/// set to true.
bool ExperimentalDependenciesIncludeIntrafileOnes = false;
/// Sets the target we are building for and updates platform conditions
/// to match.

View File

@@ -210,12 +210,13 @@ private:
/// faster rebuilds.
const bool EnableExperimentalDependencies;
/// Really slows down the driver--so only turn on when needed.
/// Helpful for debugging, but slows down the driver. So, only turn on when needed.
const bool VerifyExperimentalDependencyGraphAfterEveryImport;
/// Helpful for debugging, but slows down the driver. So, only turn on when needed.
const bool EmitExperimentalDependencyDotFileAfterEveryImport;
/// Experiment with inter-file dependencies
const bool ExperimentalDependencyIncludePrivateDeps;
const bool ExperimentalDependenciesIncludeIntrafileOnes;
template <typename T>
static T *unwrap(const std::unique_ptr<T> &p) {
@@ -250,7 +251,7 @@ public:
bool EnableExperimentalDependencies = false,
bool VerifyExperimentalDependencyGraphAfterEveryImport = false,
bool EmitExperimentalDependencyDotFileAfterEveryImport = false,
bool ExperimentalDependencyIncludePrivateDeps = false);
bool ExperimentalDependenciesIncludeIntrafileOnes = false);
// clang-format on
~Compilation();
@@ -318,8 +319,8 @@ public:
return EmitExperimentalDependencyDotFileAfterEveryImport;
}
bool getExperimentalDependencyIncludePrivateDeps() const {
return ExperimentalDependencyIncludePrivateDeps;
bool getExperimentalDependenciesIncludeIntrafileOnes() const {
return ExperimentalDependenciesIncludeIntrafileOnes;
}
bool getBatchModeEnabled() const {
@@ -359,6 +360,8 @@ public:
return Stats.get();
}
/// True if extra work has to be done when tracing through the dependency graph,
/// either in order to print dependencies or to collect statistics.
bool getTraceDependencies() const {
return getShowIncrementalBuildDecisions() || getStatsReporter();
}

View File

@@ -231,6 +231,8 @@ public:
/// ("depends") are not cleared; new dependencies are considered additive.
///
/// If \p node has already been marked, only its outgoing edges are updated.
/// The third argument is ignored here, but must be present so that the same
/// call site can polymorphically call \ref experimental_dependencies::ModuleDepGraph::loadFromPath
LoadResult loadFromPath(T node, StringRef path, DiagnosticEngine &) {
return DependencyGraphImpl::loadFromPath(Traits::getAsVoidPointer(node),
path);

View File

@@ -317,7 +317,7 @@ public:
/// Don't want to do this after every integration--too slow--
/// So export this hook to the driver.
bool emitAndVerify(DiagnosticEngine &);
bool emitDotFileAndVerify(DiagnosticEngine &);
private:
void verifyNodeMapEntries() const;

View File

@@ -139,12 +139,12 @@ InternalDebugOpt,
HelpText<"Debug DriverGraph by verifying it after every import">;
def driver_emit_experimental_dependency_dot_file_after_every_import :
Flag<["-"], "driver-experimental-dependency-include-private-deps">,
Flag<["-"], "driver-emit-experimental-dependency-dot-file-after-every-import">,
InternalDebugOpt,
HelpText<"Experiment with intra-file info by including private dependencies.">;
HelpText<"Emit dot files every time driver imports an experimental swiftdeps file.">;
def experimental_dependency_include_private_deps :
Flag<["-"], "experimental_dependency_include_private_deps">,
def experimental_dependency_include_intrafile :
Flag<["-"], "experimental-dependency-include-intrafile">,
InternalDebugOpt,
HelpText<"Include within-file dependencies.">;

View File

@@ -679,11 +679,11 @@ bool swift::experimental_dependencies::emitReferenceDependencies(
// that may have been there. No error handling -- this is just a nicety, it
// doesn't matter if it fails.
llvm::sys::fs::rename(outputPath, outputPath + "~");
const bool includePrivateDeps =
SF->getASTContext().LangOpts.ExperimentalDependenciesIncludePrivateDeps;
const bool includeIntrafileDeps =
SF->getASTContext().LangOpts.ExperimentalDependenciesIncludeIntrafileOnes;
const bool hadCompilationError = SF->getASTContext().hadError();
SourceFileDepGraphConstructor gc(SF, depTracker, outputPath,
includePrivateDeps, hadCompilationError);
includeIntrafileDeps, hadCompilationError);
SourceFileDepGraph g = gc.construct();
const bool hadError =

View File

@@ -123,7 +123,7 @@ Compilation::Compilation(DiagnosticEngine &Diags,
bool EnableExperimentalDependencies,
bool VerifyExperimentalDependencyGraphAfterEveryImport,
bool EmitExperimentalDependencyDotFileAfterEveryImport,
bool ExperimentalDependencyIncludePrivateDeps)
bool ExperimentalDependenciesIncludeIntrafileOnes)
: Diags(Diags), TheToolChain(TC),
TheOutputInfo(OI),
Level(Level),
@@ -150,8 +150,8 @@ Compilation::Compilation(DiagnosticEngine &Diags,
VerifyExperimentalDependencyGraphAfterEveryImport),
EmitExperimentalDependencyDotFileAfterEveryImport(
EmitExperimentalDependencyDotFileAfterEveryImport),
ExperimentalDependencyIncludePrivateDeps(
ExperimentalDependencyIncludePrivateDeps) {
ExperimentalDependenciesIncludeIntrafileOnes(
ExperimentalDependenciesIncludeIntrafileOnes) {
};
// clang-format on
@@ -802,7 +802,7 @@ namespace driver {
}
}
if (ExpDepGraph.hasValue())
assert(ExpDepGraph.getValue().emitAndVerify(Comp.getDiags()));
assert(ExpDepGraph.getValue().emitDotFileAndVerify(Comp.getDiags()));
}
/// Schedule transitive closure of initial jobs, and external jobs.
@@ -1433,7 +1433,7 @@ int Compilation::performJobsImpl(bool &abnormalExit,
}
}
if (State.ExpDepGraph.hasValue())
assert(State.ExpDepGraph.getValue().emitAndVerify(getDiags()));
assert(State.ExpDepGraph.getValue().emitDotFileAndVerify(getDiags()));
abnormalExit = State.hadAnyAbnormalExit();
return State.getResult();
}

View File

@@ -932,8 +932,8 @@ Driver::buildCompilation(const ToolChain &TC,
const bool EmitExperimentalDependencyDotFileAfterEveryImport = ArgList->hasArg(
options::
OPT_driver_emit_experimental_dependency_dot_file_after_every_import);
const bool ExperimentalDependencyIncludePrivateDeps = ArgList->hasArg(
options::OPT_experimental_dependency_include_private_deps);
const bool ExperimentalDependenciesIncludeIntrafileOnes = ArgList->hasArg(
options::OPT_experimental_dependency_include_intrafile);
C = llvm::make_unique<Compilation>(
Diags, TC, OI, Level,
@@ -957,7 +957,7 @@ Driver::buildCompilation(const ToolChain &TC,
EnableExperimentalDependencies,
VerifyExperimentalDependencyGraphAfterEveryImport,
EmitExperimentalDependencyDotFileAfterEveryImport,
ExperimentalDependencyIncludePrivateDeps);
ExperimentalDependenciesIncludeIntrafileOnes);
}
// Construct the graph of Actions.

View File

@@ -507,7 +507,7 @@ void ModuleDepGraph::verifyEachJobInGraphIsTracked() const {
});
}
bool ModuleDepGraph::emitAndVerify(DiagnosticEngine &diags) {
bool ModuleDepGraph::emitDotFileAndVerify(DiagnosticEngine &diags) {
if (!driverDotFileBasePath.empty())
emitDotFile(diags, driverDotFileBasePath);
return verify();

View File

@@ -222,7 +222,7 @@ static void addCommonFrontendArgs(const ToolChain &TC, const OutputInfo &OI,
inputArgs.AddLastArg(arguments,
options::OPT_enable_experimental_dependencies);
inputArgs.AddLastArg(
arguments, options::OPT_experimental_dependency_include_private_deps);
arguments, options::OPT_experimental_dependency_include_intrafile);
inputArgs.AddLastArg(arguments, options::OPT_package_description_version);
// Pass on any build config options

View File

@@ -282,8 +282,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
if (Args.hasArg(OPT_enable_experimental_dependencies))
Opts.EnableExperimentalDependencies = true;
if (Args.hasArg(OPT_experimental_dependency_include_private_deps))
Opts.ExperimentalDependenciesIncludePrivateDeps = true;
if (Args.hasArg(OPT_experimental_dependency_include_intrafile))
Opts.ExperimentalDependenciesIncludeIntrafileOnes = true;
Opts.DebuggerSupport |= Args.hasArg(OPT_debugger_support);
if (Opts.DebuggerSupport)