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;
36 typedef llvm::Registry<BasePlugin> PluginRegistry;
40 : public PluginRegistry::Add<P> {
41 typedef PluginRegistry::Add<P> Base;
43 RegisterPlugin(const char* Name = "Nameless",
44 const char* Desc = "Auto-generated plugin")
49 /// PluginLoader - Helper class used by the main program for
50 /// lifetime management.
55 /// PopulateLanguageMap - Fills in the language map by calling
56 /// PopulateLanguageMap methods of all plugins.
57 void PopulateLanguageMap(LanguageMap& langMap);
59 /// PopulateCompilationGraph - Populates the compilation graph by
60 /// calling PopulateCompilationGraph methods of all plugins.
61 void PopulateCompilationGraph(CompilationGraph& tools);
65 PluginLoader(const PluginLoader& other);
66 const PluginLoader& operator=(const PluginLoader& other);
71 #endif // LLVM_TOOLS_LLVMC2_PLUGIN_H