Files
swift-mirror/include/swift/Driver/Compilation.h
Connor Wakamo d5f95cd574 [driver] Add a new -driver-skip-execution flag.
This instructs the driver to skip task execution by using a DummyTaskQueue in Compilation::performJobsInList().
This option should generally only be used for testing, as DummyTaskQueue may provide fake buffered output.

Swift SVN r12350
2014-01-15 21:27:56 +00:00

101 lines
2.9 KiB
C++

//===--- Compilation.h - Compilation Task Data Structure --------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// TODO: Document me
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_DRIVER_COMPILATION_H
#define SWIFT_DRIVER_COMPILATION_H
#include <memory>
namespace llvm {
namespace opt {
class InputArgList;
class DerivedArgList;
}
}
namespace swift {
namespace driver {
class Driver;
class Job;
class JobList;
class ToolChain;
class Compilation {
/// The driver we were created by.
const Driver &TheDriver;
/// The default tool chain.
const ToolChain &DefaultToolChain;
/// The Jobs which will be performed by this compilation.
std::unique_ptr<JobList> Jobs;
// The original (untranslated) input argument list.
std::unique_ptr<llvm::opt::InputArgList> InputArgs;
// The translated input arg list.
std::unique_ptr<llvm::opt::DerivedArgList> TranslatedArgs;
/// The number of commands which this compilation should attempt to run in
/// parallel.
unsigned NumberOfParallelCommands;
/// \brief Indicates whether this Compilation should use skip execution of
/// subtasks during performJobs() by using a dummy TaskQueue.
///
/// \note For testing purposes only; similar user-facing features should be
/// implemented separately, as the dummy TaskQueue may provide faked output.
bool SkipTaskExecution;
public:
Compilation(const Driver &D, const ToolChain &DefaultToolChain,
std::unique_ptr<llvm::opt::InputArgList> InputArgs,
std::unique_ptr<llvm::opt::DerivedArgList> TranslatedArgs,
unsigned NumberOfParallelCommands = 1,
bool SkipTaskExecution = false);
~Compilation();
const Driver &getDriver() const { return TheDriver; }
const ToolChain &getDefaultToolChain() const { return DefaultToolChain; }
JobList &getJobs() const { return *Jobs; }
void addJob(Job *J);
const llvm::opt::InputArgList &getInputArgs() const { return *InputArgs; }
const llvm::opt::DerivedArgList &getArgs() const { return *TranslatedArgs; }
unsigned getNumberOfParallelCommands() const {
return NumberOfParallelCommands;
}
/// Asks the Compilation to perform the Jobs which it knows about.
/// \returns result code for the Compilation's Jobs; 0 indicates success
int performJobs();
private:
/// \brief Perform the Jobs in \p JL if necessary.
///
/// \returns exit code of the first failed Job, or 0 on success
int performJobsInList(const JobList &JL);
};
} // end namespace driver
} // end namespace swift
#endif