Skip to content

Commit 08cfe80

Browse files
author
David Ungar
committed
Don't crash when asking for comparison but not incremental
1 parent 5b0c4b2 commit 08cfe80

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/swift/Driver/Compilation.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ using CommandSet = llvm::SmallPtrSet<const Job *, 16>;
7979
class Compilation {
8080
public:
8181
class IncrementalSchemeComparator {
82+
const bool EnableIncrementalBuildWhenConstructed;
8283
const bool &EnableIncrementalBuild;
8384
const bool EnableSourceRangeDependencies;
8485
const bool &UseSourceRangeDependencies;
@@ -108,7 +109,8 @@ class Compilation {
108109
const StringRef CompareIncrementalSchemesPath,
109110
unsigned SwiftInputCount,
110111
DiagnosticEngine &Diags)
111-
: EnableIncrementalBuild(EnableIncrementalBuild),
112+
: EnableIncrementalBuildWhenConstructed(EnableIncrementalBuild),
113+
EnableIncrementalBuild(EnableIncrementalBuild),
112114
EnableSourceRangeDependencies(EnableSourceRangeDependencies),
113115
UseSourceRangeDependencies(UseSourceRangeDependencies),
114116
CompareIncrementalSchemesPath(CompareIncrementalSchemesPath),

lib/Driver/Compilation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,6 +2003,10 @@ void Compilation::IncrementalSchemeComparator::outputComparison() const {
20032003

20042004
void Compilation::IncrementalSchemeComparator::outputComparison(
20052005
llvm::raw_ostream &out) const {
2006+
if (!EnableIncrementalBuildWhenConstructed) {
2007+
out << "*** Incremental build was not enabled in the command line ***\n";
2008+
return;
2009+
}
20062010
if (!EnableIncrementalBuild) {
20072011
// No stats will have been gathered
20082012
assert(!WhyIncrementalWasDisabled.empty() && "Must be a reason");

0 commit comments

Comments
 (0)