diff options
| author | Andrew Lenharth <andrewl@lenharth.org> | 2006-01-26 18:36:50 +0000 |
|---|---|---|
| committer | Andrew Lenharth <andrewl@lenharth.org> | 2006-01-26 18:36:50 +0000 |
| commit | bb4c9c0bd712666ba0a8f80522851c35d1913c29 (patch) | |
| tree | 1c74a75e8eff53b9ebc9d84746f5793bf403a291 | |
| parent | b0a3ebd766a8142c5ac4d4a61ed85b7b131fb68a (diff) | |
| download | bcm5719-llvm-bb4c9c0bd712666ba0a8f80522851c35d1913c29.tar.gz bcm5719-llvm-bb4c9c0bd712666ba0a8f80522851c35d1913c29.zip | |
Remember plugins should someone like bugpoint want to know them.
llvm-svn: 25649
| -rw-r--r-- | llvm/include/llvm/Support/PluginLoader.h | 2 | ||||
| -rw-r--r-- | llvm/lib/Support/PluginLoader.cpp | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/PluginLoader.h b/llvm/include/llvm/Support/PluginLoader.h index 74e5a0394df..7789ae8b548 100644 --- a/llvm/include/llvm/Support/PluginLoader.h +++ b/llvm/include/llvm/Support/PluginLoader.h @@ -22,6 +22,8 @@ namespace llvm { struct PluginLoader { void operator=(const std::string &Filename); + static unsigned getNumPlugins(); + static std::string& getPlugin(unsigned num); }; #ifndef DONT_GET_PLUGIN_LOADER_OPTION diff --git a/llvm/lib/Support/PluginLoader.cpp b/llvm/lib/Support/PluginLoader.cpp index 799c1256584..77eb52852de 100644 --- a/llvm/lib/Support/PluginLoader.cpp +++ b/llvm/lib/Support/PluginLoader.cpp @@ -15,13 +15,17 @@ #include "llvm/Support/PluginLoader.h" #include "llvm/System/DynamicLibrary.h" #include <iostream> +#include <vector> using namespace llvm; +std::vector<std::string> plugins; + void PluginLoader::operator=(const std::string &Filename) { std::string ErrorMessage; try { sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str()); + plugins.push_back(Filename); } catch (const std::string& errmsg) { if (errmsg.empty()) { ErrorMessage = "Unknown"; @@ -33,3 +37,14 @@ void PluginLoader::operator=(const std::string &Filename) { std::cerr << "Error opening '" << Filename << "': " << ErrorMessage << "\n -load request ignored.\n"; } + +unsigned PluginLoader::getNumPlugins() +{ + return plugins.size(); +} + +std::string& PluginLoader::getPlugin(unsigned num) +{ + assert(num < plugins.size() && "Asking for an out of bounds plugin"); + return plugins[num]; +} |

