mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-04 17:47:58 +00:00
Remember plugins should someone like bugpoint want to know them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25649 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c20dee3566
commit
4b934766bd
@ -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
|
||||
|
@ -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];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user