Skip to content

Commit a2c7187

Browse files
committed
[BatchMode] Pass OutputInfo to Compilation on construction.
1 parent 83aeb39 commit a2c7187

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

include/swift/Driver/Compilation.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef SWIFT_DRIVER_COMPILATION_H
1818
#define SWIFT_DRIVER_COMPILATION_H
1919

20+
#include "swift/Driver/Driver.h"
2021
#include "swift/Driver/Job.h"
2122
#include "swift/Driver/Util.h"
2223
#include "swift/Basic/ArrayRefView.h"
@@ -42,6 +43,7 @@ namespace swift {
4243
namespace driver {
4344
class Driver;
4445
class ToolChain;
46+
class OutputInfo;
4547
class PerformJobsState;
4648

4749
/// An enum providing different levels of output which should be produced
@@ -74,6 +76,11 @@ class Compilation {
7476
/// subsequent BatchJobs.
7577
LLVM_ATTRIBUTE_UNUSED const ToolChain &TheToolChain;
7678

79+
/// The OutputInfo, which the Compilation stores a copy of upon
80+
/// construction, and which it may use to build subsequent batch
81+
/// jobs itself.
82+
OutputInfo TheOutputInfo;
83+
7784
/// The OutputLevel at which this Compilation should generate output.
7885
OutputLevel Level;
7986

@@ -182,6 +189,7 @@ class Compilation {
182189

183190
public:
184191
Compilation(DiagnosticEngine &Diags, const ToolChain &TC,
192+
OutputInfo const &OI,
185193
OutputLevel Level,
186194
std::unique_ptr<llvm::opt::InputArgList> InputArgs,
187195
std::unique_ptr<llvm::opt::DerivedArgList> TranslatedArgs,
@@ -195,6 +203,10 @@ class Compilation {
195203
std::unique_ptr<UnifiedStatsReporter> Stats = nullptr);
196204
~Compilation();
197205

206+
OutputInfo const &getOutputInfo() const {
207+
return TheOutputInfo;
208+
}
209+
198210
UnwrappedArrayView<const Action> getActions() const {
199211
return llvm::makeArrayRef(Actions);
200212
}

lib/Driver/Compilation.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const LogJobSet &ljs) {
8585

8686

8787
Compilation::Compilation(DiagnosticEngine &Diags,
88-
const ToolChain &TC, OutputLevel Level,
88+
const ToolChain &TC,
89+
OutputInfo const &OI,
90+
OutputLevel Level,
8991
std::unique_ptr<InputArgList> InputArgs,
9092
std::unique_ptr<DerivedArgList> TranslatedArgs,
9193
InputFileList InputsWithTypes,
@@ -96,9 +98,11 @@ Compilation::Compilation(DiagnosticEngine &Diags,
9698
bool SaveTemps,
9799
bool ShowDriverTimeCompilation,
98100
std::unique_ptr<UnifiedStatsReporter> StatsReporter)
99-
: Diags(Diags), TheToolChain(TC), Level(Level),
101+
: Diags(Diags), TheToolChain(TC),
102+
TheOutputInfo(OI),
103+
Level(Level),
100104
RawInputArgs(std::move(InputArgs)),
101-
TranslatedArgs(std::move(TranslatedArgs)),
105+
TranslatedArgs(std::move(TranslatedArgs)),
102106
InputFilesWithTypes(std::move(InputsWithTypes)), ArgsHash(ArgsHash),
103107
BuildStartTime(StartTime),
104108
NumberOfParallelCommands(NumberOfParallelCommands),

lib/Driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ Driver::buildCompilation(const ToolChain &TC,
672672
llvm_unreachable("Unknown OutputLevel argument!");
673673
}
674674

675-
std::unique_ptr<Compilation> C(new Compilation(Diags, TC, Level,
675+
std::unique_ptr<Compilation> C(new Compilation(Diags, TC, OI, Level,
676676
std::move(ArgList),
677677
std::move(TranslatedArgList),
678678
std::move(Inputs),

0 commit comments

Comments
 (0)