mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Driver] Use return value instead of out parameter for buildOutputFileMap.
No functionality change, just a cleanup. Swift SVN r23966
This commit is contained in:
@@ -208,13 +208,8 @@ public:
|
||||
ActionList &Actions) const;
|
||||
|
||||
/// Construct the OutputFileMap for the driver from the given arguments.
|
||||
///
|
||||
/// \param Args The input arguments.
|
||||
/// \param[out] OFM a unique_ptr which, upon return, will point to the
|
||||
/// OutputFileMap for this driver, or nullptr if one does not exist
|
||||
/// (or could not be constructed).
|
||||
void buildOutputFileMap(const llvm::opt::DerivedArgList &Args,
|
||||
std::unique_ptr<OutputFileMap> &OFM) const;
|
||||
std::unique_ptr<OutputFileMap>
|
||||
buildOutputFileMap(const llvm::opt::DerivedArgList &Args) const;
|
||||
|
||||
/// Add top-level Jobs to Compilation \p C for the given \p Actions and
|
||||
/// OutputInfo.
|
||||
|
||||
@@ -47,8 +47,8 @@ Compilation::Compilation(const Driver &D, const ToolChain &DefaultToolChain,
|
||||
Level(Level), Jobs(new JobList), InputArgs(std::move(InputArgs)),
|
||||
TranslatedArgs(std::move(TranslatedArgs)),
|
||||
NumberOfParallelCommands(NumberOfParallelCommands),
|
||||
EnableIncrementalBuild(EnableIncrementalBuild),
|
||||
SkipTaskExecution(SkipTaskExecution) {
|
||||
SkipTaskExecution(SkipTaskExecution),
|
||||
EnableIncrementalBuild(EnableIncrementalBuild) {
|
||||
};
|
||||
|
||||
using CommandSet = llvm::DenseSet<const Job *>;
|
||||
|
||||
@@ -201,8 +201,7 @@ std::unique_ptr<Compilation> Driver::buildCompilation(
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<OutputFileMap> OFM;
|
||||
buildOutputFileMap(*TranslatedArgList, OFM);
|
||||
std::unique_ptr<OutputFileMap> OFM = buildOutputFileMap(*TranslatedArgList);
|
||||
|
||||
if (Diags.hadAnyError())
|
||||
return nullptr;
|
||||
@@ -934,19 +933,19 @@ bool Driver::handleImmediateArgs(const ArgList &Args, const ToolChain &TC) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Driver::buildOutputFileMap(const llvm::opt::DerivedArgList &Args,
|
||||
std::unique_ptr<OutputFileMap> &OFM) const {
|
||||
if (const Arg *A = Args.getLastArg(options::OPT_output_file_map)) {
|
||||
std::unique_ptr<OutputFileMap>
|
||||
Driver::buildOutputFileMap(const llvm::opt::DerivedArgList &Args) const {
|
||||
const Arg *A = Args.getLastArg(options::OPT_output_file_map);
|
||||
if (!A)
|
||||
return nullptr;
|
||||
|
||||
// TODO: perform some preflight checks to ensure the file exists.
|
||||
OFM = OutputFileMap::loadFromPath(A->getValue());
|
||||
if (!OFM)
|
||||
auto OFM = OutputFileMap::loadFromPath(A->getValue());
|
||||
if (!OFM) {
|
||||
// TODO: emit diagnostic with error string
|
||||
Diags.diagnose(SourceLoc(), diag::error_unable_to_load_output_file_map);
|
||||
} else {
|
||||
// We don't have an OutputFileMap, so reset the unique_ptr.
|
||||
OFM.reset();
|
||||
}
|
||||
return std::move(OFM);
|
||||
}
|
||||
|
||||
void Driver::buildJobs(const ActionList &Actions, const OutputInfo &OI,
|
||||
|
||||
Reference in New Issue
Block a user