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