xref: /llvm-project/llvm/lib/Support/PluginLoader.cpp (revision 99dcad4584c266e12033e0720afcbe1b5cfedfdb)
1 //===-- PluginLoader.cpp - Implement -load command line option ------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the -load <plugin> command line option handler.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #define DONT_GET_PLUGIN_LOADER_OPTION
15 #include "Support/PluginLoader.h"
16 #include "Support/DynamicLinker.h"
17 #include <iostream>
18 using namespace llvm;
19 
20 void PluginLoader::operator=(const std::string &Filename) {
21   std::string ErrorMessage;
22   if (LinkDynamicObject(Filename.c_str(), &ErrorMessage))
23     std::cerr << "Error opening '" << Filename << "': " << ErrorMessage
24               << "\n  -load request ignored.\n";
25 }
26