Reid Spencer | 2594c9a | 2004-08-13 20:21:22 +0000 | [diff] [blame^] | 1 | //===- ConfigData.h - Configuration Data Provider ---------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by Reid Spencer and is distributed under the |
| 6 | // University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file declares the LLVMC_ConfigDataProvider class which implements the |
| 11 | // generation of ConfigData objects for the CompilerDriver. |
| 12 | // |
| 13 | //===------------------------------------------------------------------------=== |
| 14 | #ifndef LLVM_TOOLS_LLVMC_CONFIGDATA_H |
| 15 | #define LLVM_TOOLS_LLVMC_CONFIGDATA_H |
| 16 | |
| 17 | #include "CompilerDriver.h" |
| 18 | #include <Support/hash_map> |
| 19 | |
| 20 | namespace llvm { |
| 21 | /// This class provides the high level interface to the LLVM Compiler Driver. |
| 22 | /// The driver's purpose is to make it easier for compiler writers and users |
| 23 | /// of LLVM to utilize the compiler toolkits and LLVM toolset by learning only |
| 24 | /// the interface of one program (llvmc). |
| 25 | /// |
| 26 | /// @see llvmc.cpp |
| 27 | /// @brief The interface to the LLVM Compiler Driver. |
| 28 | class LLVMC_ConfigDataProvider : public CompilerDriver::ConfigDataProvider { |
| 29 | /// @name Constructor |
| 30 | /// @{ |
| 31 | public: |
| 32 | LLVMC_ConfigDataProvider(); |
| 33 | virtual ~LLVMC_ConfigDataProvider(); |
| 34 | |
| 35 | /// @name Methods |
| 36 | /// @{ |
| 37 | public: |
| 38 | /// @brief Provide the configuration data to the CompilerDriver. |
| 39 | virtual CompilerDriver::ConfigData* |
| 40 | ProvideConfigData(const std::string& filetype); |
| 41 | |
| 42 | /// @brief Allow the configuration directory to be set |
| 43 | virtual void setConfigDir(const std::string& dirName) { configDir = dirName; } |
| 44 | |
| 45 | /// @} |
| 46 | /// @name Data |
| 47 | /// @{ |
| 48 | private: |
| 49 | /// @brief This type is used internally to hold the configuration data. |
| 50 | typedef hash_map<std::string,CompilerDriver::ConfigData*, |
| 51 | hash<std::string>,std::equal_to<std::string> > ConfigDataMap; |
| 52 | ConfigDataMap Configurations; ///< The cache of configurations |
| 53 | std::string configDir; |
| 54 | /// @} |
| 55 | }; |
| 56 | } |
| 57 | |
| 58 | #endif |