Skip to content

Commit 3ecb0b0

Browse files
committed
[NFC] Move "HadAbnormalExit" Flag Into Compilation::Result
1 parent d815e27 commit 3ecb0b0

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

include/swift/Driver/Compilation.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ using CommandSet = llvm::SmallPtrSet<const Job *, 16>;
8080
class Compilation {
8181
public:
8282
struct Result {
83+
/// Set to true if any job exits abnormally (i.e. crashes).
84+
bool hadAbnormalExit;
8385
int exitCode;
8486
fine_grained_dependencies::ModuleDepGraph depGraph;
8587
};
@@ -540,14 +542,11 @@ class Compilation {
540542
private:
541543
/// Perform all jobs.
542544
///
543-
/// \param[out] abnormalExit Set to true if any job exits abnormally (i.e.
544-
/// crashes).
545545
/// \param TQ The task queue on which jobs will be scheduled.
546546
///
547547
/// \returns exit code of the first failed Job, or 0 on success. If a Job
548548
/// crashes during execution, a negative value will be returned.
549-
Compilation::Result performJobsImpl(bool &abnormalExit,
550-
std::unique_ptr<sys::TaskQueue> &&TQ);
549+
Compilation::Result performJobsImpl(std::unique_ptr<sys::TaskQueue> &&TQ);
551550

552551
/// Performs a single Job by executing in place, if possible.
553552
///

lib/Driver/Compilation.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,8 +1945,7 @@ static bool writeFilelistIfNecessary(const Job *job, const ArgList &args,
19451945
}
19461946

19471947
Compilation::Result
1948-
Compilation::performJobsImpl(bool &abnormalExit,
1949-
std::unique_ptr<TaskQueue> &&TQ) {
1948+
Compilation::performJobsImpl(std::unique_ptr<TaskQueue> &&TQ) {
19501949
PerformJobsState State(*this, std::move(TQ));
19511950

19521951
State.runJobs();
@@ -1956,13 +1955,11 @@ Compilation::performJobsImpl(bool &abnormalExit,
19561955
State.populateInputInfoMap(InputInfo);
19571956
checkForOutOfDateInputs(Diags, InputInfo);
19581957

1959-
abnormalExit = State.hadAnyAbnormalExit();
19601958
auto result = std::move(State).takeResult();
19611959
writeCompilationRecord(CompilationRecordPath, ArgsHash, BuildStartTime,
19621960
InputInfo);
19631961
return result;
19641962
} else {
1965-
abnormalExit = State.hadAnyAbnormalExit();
19661963
return std::move(State).takeResult();
19671964
}
19681965
}
@@ -2062,15 +2059,14 @@ Compilation::Result Compilation::performJobs(std::unique_ptr<TaskQueue> &&TQ) {
20622059
Diags.diagnose(SourceLoc(), diag::warning_parallel_execution_not_supported);
20632060
}
20642061

2065-
bool abnormalExit;
2066-
auto result = performJobsImpl(abnormalExit, std::move(TQ));
2062+
auto result = performJobsImpl(std::move(TQ));
20672063

20682064
if (IncrementalComparator)
20692065
IncrementalComparator->outputComparison();
20702066

20712067
if (!SaveTemps) {
20722068
for (const auto &pathPair : TempFilePaths) {
2073-
if (!abnormalExit || pathPair.getValue() == PreserveOnSignal::No)
2069+
if (!result.hadAbnormalExit || pathPair.getValue() == PreserveOnSignal::No)
20742070
(void)llvm::sys::fs::remove(pathPair.getKey());
20752071
}
20762072
}

0 commit comments

Comments
 (0)