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
20 class CompilationGraph;
22 /// BasePlugin - An abstract base class for all LLVMC plugins.
25 /// PopulateLanguageMap - The auto-generated function that fills in
26 /// the language map (map from file extensions to language names).
27 virtual void PopulateLanguageMap(LanguageMap&) const = 0;
29 /// PopulateCompilationGraph - The auto-generated function that
30 /// populates the compilation graph with nodes and edges.
31 virtual void PopulateCompilationGraph(CompilationGraph&) const = 0;
34 // Helper class for RegisterPlugin.
35 class RegisterPluginImpl {
37 RegisterPluginImpl(BasePlugin*);
40 /// RegisterPlugin<T> template - Used to register LLVMC plugins.
42 struct RegisterPlugin : RegisterPluginImpl {
43 RegisterPlugin() : RegisterPluginImpl (new T()) {}
46 /// PopulateLanguageMap - Fills in the language map by calling
47 /// PopulateLanguageMap methods of all plugins.
48 void PopulateLanguageMap(LanguageMap& langMap);
50 /// PopulateCompilationGraph - Populates the compilation graph by
51 /// calling PopulateCompilationGraph methods of all plugins.
52 void PopulateCompilationGraph(CompilationGraph& tools);
56 #endif // LLVM_TOOLS_LLVMC2_PLUGIN_H