1193323Sed//===-- llvm/Support/PluginLoader.h - Plugin Loader for Tools ---*- C++ -*-===// 2193323Sed// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6193323Sed// 7193323Sed//===----------------------------------------------------------------------===// 8193323Sed// 9193323Sed// A tool can #include this file to get a -load option that allows the user to 10193323Sed// load arbitrary shared objects into the tool's address space. Note that this 11193323Sed// header can only be included by a program ONCE, so it should never to used by 12193323Sed// library authors. 13193323Sed// 14193323Sed//===----------------------------------------------------------------------===// 15193323Sed 16193323Sed#ifndef LLVM_SUPPORT_PLUGINLOADER_H 17193323Sed#define LLVM_SUPPORT_PLUGINLOADER_H 18193323Sed 19193323Sed#include "llvm/Support/CommandLine.h" 20193323Sed 21193323Sednamespace llvm { 22193323Sed struct PluginLoader { 23193323Sed void operator=(const std::string &Filename); 24193323Sed static unsigned getNumPlugins(); 25193323Sed static std::string& getPlugin(unsigned num); 26193323Sed }; 27193323Sed 28193323Sed#ifndef DONT_GET_PLUGIN_LOADER_OPTION 29193323Sed // This causes operator= above to be invoked for every -load option. 30193323Sed static cl::opt<PluginLoader, false, cl::parser<std::string> > 31193323Sed LoadOpt("load", cl::ZeroOrMore, cl::value_desc("pluginfilename"), 32193323Sed cl::desc("Load the specified plugin")); 33193323Sed#endif 34193323Sed} 35193323Sed 36193323Sed#endif 37