summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/PluginLoader.cpp
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2006-01-26 18:36:50 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2006-01-26 18:36:50 +0000
commitbb4c9c0bd712666ba0a8f80522851c35d1913c29 (patch)
tree1c74a75e8eff53b9ebc9d84746f5793bf403a291 /llvm/lib/Support/PluginLoader.cpp
parentb0a3ebd766a8142c5ac4d4a61ed85b7b131fb68a (diff)
downloadbcm5719-llvm-bb4c9c0bd712666ba0a8f80522851c35d1913c29.tar.gz
bcm5719-llvm-bb4c9c0bd712666ba0a8f80522851c35d1913c29.zip
Remember plugins should someone like bugpoint want to know them.
llvm-svn: 25649
Diffstat (limited to 'llvm/lib/Support/PluginLoader.cpp')
-rw-r--r--llvm/lib/Support/PluginLoader.cpp15
1 files changed, 15 insertions, 0 deletions
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];
+}
OpenPOWER on IntegriCloud