1 //===--- Plugin.h - The LLVM Compiler Driver --------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open
6 // Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Plugin support for llvmc2.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TOOLS_LLVMC2_PLUGIN_H
15 #define LLVM_TOOLS_LLVMC2_PLUGIN_H
17 #include "llvm/Support/Registry.h"
22 class CompilationGraph;
24 /// BasePlugin - An abstract base class for all LLVMC plugins.
27 /// PopulateLanguageMap - The auto-generated function that fills in
28 /// the language map (map from file extensions to language names).
29 virtual void PopulateLanguageMap(LanguageMap&) const = 0;
31 /// PopulateCompilationGraph - The auto-generated function that
32 /// populates the compilation graph with nodes and edges.
33 virtual void PopulateCompilationGraph(CompilationGraph&) const = 0;
35 /// Needed to avoid a compiler warning.
36 virtual ~BasePlugin() {};
39 typedef llvm::Registry<BasePlugin> PluginRegistry;
43 : public PluginRegistry::Add<P> {
44 typedef PluginRegistry::Add<P> Base;
46 RegisterPlugin(const char* Name = "Nameless",
47 const char* Desc = "Auto-generated plugin")
52 /// PluginLoader - Helper class used by the main program for
53 /// lifetime management.
58 /// PopulateLanguageMap - Fills in the language map by calling
59 /// PopulateLanguageMap methods of all plugins.
60 void PopulateLanguageMap(LanguageMap& langMap);
62 /// PopulateCompilationGraph - Populates the compilation graph by
63 /// calling PopulateCompilationGraph methods of all plugins.
64 void PopulateCompilationGraph(CompilationGraph& tools);
68 PluginLoader(const PluginLoader& other);
69 const PluginLoader& operator=(const PluginLoader& other);
74 #endif // LLVM_TOOLS_LLVMC2_PLUGIN_H