//===- CompilerDriver.h - Compiler Driver -----------------------*- C++ -*-===//
-//
+//
// The LLVM Compiler Infrastructure
//
-// This file was developed by Reid Spencer and is distributed under the
+// This file was developed by Reid Spencer and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
-//
+//
//===----------------------------------------------------------------------===//
//
// This file declares the CompilerDriver class which implements the bulk of the
// LLVM Compiler Driver program (llvmc).
//
-//===------------------------------------------------------------------------===
+//===----------------------------------------------------------------------===//
+
#ifndef LLVM_TOOLS_LLVMC_COMPILERDRIVER_H
#define LLVM_TOOLS_LLVMC_COMPILERDRIVER_H
/// The driver's purpose is to make it easier for compiler writers and users
/// of LLVM to utilize the compiler toolkits and LLVM toolset by learning only
/// the interface of one program (llvmc).
- ///
+ ///
/// @see llvmc.cpp
/// @brief The interface to the LLVM Compiler Driver.
class CompilerDriver {
enum Phases {
PREPROCESSING, ///< Source language combining, filtering, substitution
TRANSLATION, ///< Translate source -> LLVM bytecode/assembly
- OPTIMIZATION, ///< Optimize translation result
+ OPTIMIZATION, ///< Optimize translation result
ASSEMBLY, ///< Convert program to executable
LINKING, ///< Link bytecode and native code
NUM_PHASES ///< Always last!
PREPROCESSES_FLAG = 0x0002, ///< Does this action preprocess?
TRANSLATES_FLAG = 0x0004, ///< Does this action translate?
OUTPUT_IS_ASM_FLAG = 0x0008, ///< Action produces .ll files?
- FLAGS_MASK = 0x000F, ///< Union of all flags
+ FLAGS_MASK = 0x000F ///< Union of all flags
};
/// This type is the input list to the CompilerDriver. It provides
/// language.
struct Action {
Action() : flags(0) {}
- sys::Path program; ///< The program to execve
- StringVector args; ///< Arguments to the program
- unsigned flags; ///< Action specific flags
+ sys::Path program; ///< The program to execve
+ StringVector args; ///< Arguments to the program
+ unsigned flags; ///< Action specific flags
void set(unsigned fl ) { flags |= fl; }
void clear(unsigned fl) { flags &= (FLAGS_MASK ^ fl); }
bool isSet(unsigned fl) { return (flags&fl) != 0; }
struct ConfigData {
ConfigData();
std::string version; ///< The version number.
- std::string langName; ///< The name of the source language
+ std::string langName; ///< The name of the source language
StringTable opts; ///< The o10n options for each level
StringVector libpaths; ///< The library paths
Action PreProcessor; ///< PreProcessor command line
/// This pure virtual interface class defines the interface between the
/// CompilerDriver and other software that provides ConfigData objects to
/// it. The CompilerDriver must be configured to use an object of this
- /// type so it can obtain the configuration data.
+ /// type so it can obtain the configuration data.
/// @see setConfigDataProvider
/// @brief Configuration Data Provider interface
class ConfigDataProvider {
public:
+ virtual ~ConfigDataProvider();
virtual ConfigData* ProvideConfigData(const std::string& filetype) = 0;
virtual void setConfigDir(const sys::Path& dirName) = 0;
};
/// These flags control various actions of the compiler driver. They are
/// used by adding the needed flag values together and passing them to the
- /// compiler driver's setDriverFlags method.
+ /// compiler driver's setDriverFlags method.
/// @see setDriverFlags
/// @brief Driver specific flags
enum DriverFlags {
EMIT_RAW_FLAG = 0x0080, ///< Emit raw, unoptimized bytecode
KEEP_TEMPS_FLAG = 0x0100, ///< Don't delete temporary files
STRIP_OUTPUT_FLAG = 0x0200, ///< Strip symbols from linked output
- DRIVER_FLAGS_MASK = 0x03FF, ///< Union of the above flags
+ DRIVER_FLAGS_MASK = 0x03FF ///< Union of the above flags
};
/// @}
/// @{
public:
/// @brief Execute the actions requested for the given input list.
- virtual int execute(const InputList& list, const sys::Path& output) = 0;
+ virtual int execute(
+ const InputList& list, const sys::Path& output, std::string& ErrMsg) =0;
/// @brief Set the final phase at which compilation terminates
virtual void setFinalPhase(Phases phase) = 0;
virtual void setOutputMachine(const std::string& machineName) = 0;
/// @brief Set the options for a given phase.
- virtual void setPhaseArgs(Phases phase, const StringVector& opts) = 0;
+ virtual void setPhaseArgs(Phases phase, const StringVector& opts) = 0;
/// @brief Set Library Paths
virtual void setIncludePaths(const StringVector& paths) = 0;