#ifndef CLANG_DRIVER_TOOL_H_
#define CLANG_DRIVER_TOOL_H_
+namespace llvm {
+ template<typename T, unsigned N> class SmallVector;
+}
+
namespace clang {
namespace driver {
+ class ArgList;
+ class Compilation;
+ class InputInfo;
+ class JobAction;
class ToolChain;
+ typedef llvm::SmallVector<InputInfo, 4> InputInfoList;
+
/// Tool - Information on a specific compilation tool.
class Tool {
/// The tool name (for debugging).
virtual bool acceptsPipedInput() const = 0;
virtual bool canPipeOutput() const = 0;
virtual bool hasIntegratedCPP() const = 0;
+
+ /// ConstructJob - Construct jobs to perform the action \arg JA,
+ /// writing to \arg Output and with \arg Inputs.
+ ///
+ /// \param TCArgs - The argument list for this toolchain, with any
+ /// tool chain specific translations applied.
+ /// \param LinkingOutput - If this output will eventually feed the
+ /// linker, then this is the final output name of the linked image.
+ virtual void ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const = 0;
};
} // end namespace driver
/// ActionList - Type used for lists of actions.
typedef llvm::SmallVector<Action*, 3> ActionList;
+
} // end namespace driver
} // end namespace clang
// Only use pipes when there is exactly one input.
bool TryToUsePipeInput = Inputs->size() == 1 && T.acceptsPipedInput();
- llvm::SmallVector<InputInfo, 4> InputInfos;
+ InputInfoList InputInfos;
for (ActionList::const_iterator it = Inputs->begin(), ie = Inputs->end();
it != ie; ++it) {
InputInfo II;
}
llvm::errs() << "], output: " << Result.getAsString() << "\n";
} else {
- assert(0 && "FIXME: Make the job.");
+ const ArgList &TCArgs = C.getArgsForToolChain(TC);
+ T.ConstructJob(C, *JA, Result, InputInfos, TCArgs, LinkingOutput);
}
}
--- /dev/null
+//===--- Tools.cpp - Tools Implementations ------------------------------*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Tools.h"
+
+using namespace clang::driver;
+using namespace clang::driver::tools;
+
+void Clang::ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const {
+
+}
+
+void gcc::Preprocess::ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const {
+
+}
+
+void gcc::Precompile::ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const {
+
+}
+
+void gcc::Compile::ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const {
+
+}
+
+void gcc::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const {
+
+}
+
+void gcc::Link::ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const {
+
+}
virtual bool acceptsPipedInput() const { return true; }
virtual bool canPipeOutput() const { return true; }
virtual bool hasIntegratedCPP() const { return true; }
+
+ virtual void ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const;
};
/// gcc - Generic GCC tool implementations.
virtual bool acceptsPipedInput() const { return true; }
virtual bool canPipeOutput() const { return true; }
virtual bool hasIntegratedCPP() const { return false; }
+
+ virtual void ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const;
};
class VISIBILITY_HIDDEN Precompile : public Tool {
virtual bool acceptsPipedInput() const { return true; }
virtual bool canPipeOutput() const { return false; }
virtual bool hasIntegratedCPP() const { return true; }
+
+ virtual void ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const;
};
class VISIBILITY_HIDDEN Compile : public Tool {
virtual bool acceptsPipedInput() const { return true; }
virtual bool canPipeOutput() const { return true; }
virtual bool hasIntegratedCPP() const { return true; }
+
+ virtual void ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const;
};
class VISIBILITY_HIDDEN Assemble : public Tool {
virtual bool acceptsPipedInput() const { return true; }
virtual bool canPipeOutput() const { return false; }
virtual bool hasIntegratedCPP() const { return false; }
+
+ virtual void ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const;
};
class VISIBILITY_HIDDEN Link : public Tool {
virtual bool acceptsPipedInput() const { return false; }
virtual bool canPipeOutput() const { return false; }
virtual bool hasIntegratedCPP() const { return false; }
+
+ virtual void ConstructJob(Compilation &C, const JobAction &JA,
+ InputInfo &Output, InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const;
};
} // end namespace gcc