PluginLoader.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- llvm/Support/PluginLoader.h - Plugin Loader for Tools ---*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // A tool can #include this file to get a -load option that allows the user to
  15. // load arbitrary shared objects into the tool's address space. Note that this
  16. // header can only be included by a program ONCE, so it should never to used by
  17. // library authors.
  18. //
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_SUPPORT_PLUGINLOADER_H
  21. #define LLVM_SUPPORT_PLUGINLOADER_H
  22. #ifndef DONT_GET_PLUGIN_LOADER_OPTION
  23. #include "llvm/Support/CommandLine.h"
  24. #endif
  25. #include <string>
  26. namespace llvm {
  27. struct PluginLoader {
  28. void operator=(const std::string &Filename);
  29. static unsigned getNumPlugins();
  30. static std::string& getPlugin(unsigned num);
  31. };
  32. #ifndef DONT_GET_PLUGIN_LOADER_OPTION
  33. // This causes operator= above to be invoked for every -load option.
  34. static cl::opt<PluginLoader, false, cl::parser<std::string> >
  35. LoadOpt("load", cl::ZeroOrMore, cl::value_desc("pluginfilename"),
  36. cl::desc("Load the specified plugin"));
  37. #endif
  38. }
  39. #endif
  40. #ifdef __GNUC__
  41. #pragma GCC diagnostic pop
  42. #endif