summaryrefslogtreecommitdiff
path: root/include/clang/Driver/Driver.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Driver/Driver.h')
-rw-r--r--include/clang/Driver/Driver.h51
1 files changed, 39 insertions, 12 deletions
diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h
index 4a67fdb6532ad..c9940ba5501f9 100644
--- a/include/clang/Driver/Driver.h
+++ b/include/clang/Driver/Driver.h
@@ -36,6 +36,11 @@ namespace opt {
}
namespace clang {
+
+namespace vfs {
+class FileSystem;
+}
+
namespace driver {
class Action;
@@ -47,6 +52,14 @@ namespace driver {
class SanitizerArgs;
class ToolChain;
+/// Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
+enum LTOKind {
+ LTOK_None,
+ LTOK_Full,
+ LTOK_Thin,
+ LTOK_Unknown
+};
+
/// Driver - Encapsulate logic for constructing compilation processes
/// from a set of gcc-driver-like command line arguments.
class Driver {
@@ -54,6 +67,8 @@ class Driver {
DiagnosticsEngine &Diags;
+ IntrusiveRefCntPtr<vfs::FileSystem> VFS;
+
enum DriverMode {
GCCMode,
GXXMode,
@@ -67,6 +82,9 @@ class Driver {
SaveTempsObj
} SaveTemps;
+ /// LTO mode selected via -f(no-)?lto(=.*)? options.
+ LTOKind LTOMode;
+
public:
// Diag - Forwarding function for diagnostics.
DiagnosticBuilder Diag(unsigned DiagID) const {
@@ -201,9 +219,9 @@ private:
SmallVectorImpl<std::string> &Names) const;
public:
- Driver(StringRef _ClangExecutable,
- StringRef _DefaultTargetTriple,
- DiagnosticsEngine &_Diags);
+ Driver(StringRef ClangExecutable, StringRef DefaultTargetTriple,
+ DiagnosticsEngine &Diags,
+ IntrusiveRefCntPtr<vfs::FileSystem> VFS = nullptr);
~Driver();
/// @name Accessors
@@ -216,6 +234,8 @@ public:
const DiagnosticsEngine &getDiags() const { return Diags; }
+ vfs::FileSystem &getVFS() const { return *VFS; }
+
bool getCheckInputsExist() const { return CheckInputsExist; }
void setCheckInputsExist(bool Value) { CheckInputsExist = Value; }
@@ -277,22 +297,21 @@ public:
/// BuildActions - Construct the list of actions to perform for the
/// given arguments, which are only done for a single architecture.
///
+ /// \param C - The compilation that is being built.
/// \param TC - The default host tool chain.
/// \param Args - The input arguments.
/// \param Actions - The list to store the resulting actions onto.
- void BuildActions(const ToolChain &TC, llvm::opt::DerivedArgList &Args,
- const InputList &Inputs, ActionList &Actions) const;
+ void BuildActions(Compilation &C, const ToolChain &TC,
+ llvm::opt::DerivedArgList &Args, const InputList &Inputs,
+ ActionList &Actions) const;
/// BuildUniversalActions - Construct the list of actions to perform
/// for the given arguments, which may require a universal build.
///
+ /// \param C - The compilation that is being built.
/// \param TC - The default host tool chain.
- /// \param Args - The input arguments.
- /// \param Actions - The list to store the resulting actions onto.
- void BuildUniversalActions(const ToolChain &TC,
- llvm::opt::DerivedArgList &Args,
- const InputList &BAInputs,
- ActionList &Actions) const;
+ void BuildUniversalActions(Compilation &C, const ToolChain &TC,
+ const InputList &BAInputs) const;
/// BuildJobs - Bind actions to concrete tools and translate
/// arguments to form the list of jobs to run.
@@ -402,9 +421,17 @@ public:
/// handle this action.
bool ShouldUseClangCompiler(const JobAction &JA) const;
- bool IsUsingLTO(const llvm::opt::ArgList &Args) const;
+ /// Returns true if we are performing any kind of LTO.
+ bool isUsingLTO() const { return LTOMode != LTOK_None; }
+
+ /// Get the specific kind of LTO being performed.
+ LTOKind getLTOMode() const { return LTOMode; }
private:
+ /// Parse the \p Args list for LTO options and record the type of LTO
+ /// compilation based on which -f(no-)?lto(=.*)? option occurs last.
+ void setLTOMode(const llvm::opt::ArgList &Args);
+
/// \brief Retrieves a ToolChain for a particular \p Target triple.
///
/// Will cache ToolChains for the life of the driver object, and create them