Reid Spencer | cbabe7f | 2004-08-19 21:17:53 +0000 | [diff] [blame] | 1 | //===- Configuration.h - Configuration Data Mgmt ----------------*- C++ -*-===// |
Reid Spencer | 2594c9a | 2004-08-13 20:21:22 +0000 | [diff] [blame] | 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" |
Reid Spencer | 551ccae | 2004-09-01 22:55:40 +0000 | [diff] [blame^] | 18 | #include <llvm/ADT/hash_map> |
Reid Spencer | 2594c9a | 2004-08-13 20:21:22 +0000 | [diff] [blame] | 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: |
Reid Spencer | 2594c9a | 2004-08-13 20:21:22 +0000 | [diff] [blame] | 32 | virtual ~LLVMC_ConfigDataProvider(); |
| 33 | |
| 34 | /// @name Methods |
| 35 | /// @{ |
| 36 | public: |
| 37 | /// @brief Provide the configuration data to the CompilerDriver. |
| 38 | virtual CompilerDriver::ConfigData* |
| 39 | ProvideConfigData(const std::string& filetype); |
| 40 | |
| 41 | /// @brief Allow the configuration directory to be set |
Reid Spencer | 52c2dc1 | 2004-08-29 19:26:56 +0000 | [diff] [blame] | 42 | virtual void setConfigDir(const sys::Path& dirName) { |
| 43 | configDir = dirName; |
| 44 | } |
Reid Spencer | 2594c9a | 2004-08-13 20:21:22 +0000 | [diff] [blame] | 45 | |
Reid Spencer | 68fb37a | 2004-08-14 09:37:15 +0000 | [diff] [blame] | 46 | private: |
| 47 | CompilerDriver::ConfigData* ReadConfigData(const std::string& ftype); |
| 48 | |
Reid Spencer | 2594c9a | 2004-08-13 20:21:22 +0000 | [diff] [blame] | 49 | /// @} |
| 50 | /// @name Data |
| 51 | /// @{ |
| 52 | private: |
| 53 | /// @brief This type is used internally to hold the configuration data. |
| 54 | typedef hash_map<std::string,CompilerDriver::ConfigData*, |
| 55 | hash<std::string>,std::equal_to<std::string> > ConfigDataMap; |
| 56 | ConfigDataMap Configurations; ///< The cache of configurations |
Reid Spencer | 52c2dc1 | 2004-08-29 19:26:56 +0000 | [diff] [blame] | 57 | sys::Path configDir; |
Reid Spencer | 2594c9a | 2004-08-13 20:21:22 +0000 | [diff] [blame] | 58 | /// @} |
| 59 | }; |
| 60 | } |
| 61 | |
| 62 | #endif |