[llvm-commits] CVS: llvm/lib/Support/PluginLoader.cpp

Andrew Lenharth alenhar2 at cs.uiuc.edu
Thu Jan 26 10:37:38 PST 2006



Changes in directory llvm/lib/Support:

PluginLoader.cpp updated: 1.15 -> 1.16
---
Log message:

Remember plugins should someone like bugpoint want to know them.


---
Diffs of the changes:  (+15 -0)

 PluginLoader.cpp |   15 +++++++++++++++
 1 files changed, 15 insertions(+)


Index: llvm/lib/Support/PluginLoader.cpp
diff -u llvm/lib/Support/PluginLoader.cpp:1.15 llvm/lib/Support/PluginLoader.cpp:1.16
--- llvm/lib/Support/PluginLoader.cpp:1.15	Thu Apr 21 23:08:29 2005
+++ llvm/lib/Support/PluginLoader.cpp	Thu Jan 26 12:36:43 2006
@@ -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 @@
     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];
+}






More information about the llvm-commits mailing list