summaryrefslogtreecommitdiffstats
path: root/include/llvm/CompilerDriver/Plugin.h
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-09-22 20:50:40 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-09-22 20:50:40 +0000
commit62ab31103a0656f6ce032e20d3874dd9c5c7cccc (patch)
treee2b08ff91496f34d8c324f1fb1c498547c8a9749 /include/llvm/CompilerDriver/Plugin.h
parent945522f6b1f2d21bbe7bcd69c174a8e455c84f8c (diff)
downloadexternal_llvm-62ab31103a0656f6ce032e20d3874dd9c5c7cccc.zip
external_llvm-62ab31103a0656f6ce032e20d3874dd9c5c7cccc.tar.gz
external_llvm-62ab31103a0656f6ce032e20d3874dd9c5c7cccc.tar.bz2
Move llvmc2 header files under include/llvm/CompilerDriver
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56466 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CompilerDriver/Plugin.h')
-rw-r--r--include/llvm/CompilerDriver/Plugin.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/include/llvm/CompilerDriver/Plugin.h b/include/llvm/CompilerDriver/Plugin.h
new file mode 100644
index 0000000..ba22450
--- /dev/null
+++ b/include/llvm/CompilerDriver/Plugin.h
@@ -0,0 +1,56 @@
+//===--- Plugin.h - The LLVM Compiler Driver --------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open
+// Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Plugin support for llvmc2.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVMC2_PLUGIN_H
+#define LLVM_TOOLS_LLVMC2_PLUGIN_H
+
+namespace llvmc {
+
+ class LanguageMap;
+ class CompilationGraph;
+
+ /// BasePlugin - An abstract base class for all LLVMC plugins.
+ struct BasePlugin {
+
+ /// PopulateLanguageMap - The auto-generated function that fills in
+ /// the language map (map from file extensions to language names).
+ virtual void PopulateLanguageMap(LanguageMap&) const = 0;
+
+ /// PopulateCompilationGraph - The auto-generated function that
+ /// populates the compilation graph with nodes and edges.
+ virtual void PopulateCompilationGraph(CompilationGraph&) const = 0;
+ };
+
+ // Helper class for RegisterPlugin.
+ class RegisterPluginImpl {
+ protected:
+ RegisterPluginImpl(BasePlugin*);
+ };
+
+ /// RegisterPlugin<T> template - Used to register LLVMC plugins.
+ template <class T>
+ struct RegisterPlugin : RegisterPluginImpl {
+ RegisterPlugin() : RegisterPluginImpl (new T()) {}
+ };
+
+ /// PopulateLanguageMap - Fills in the language map by calling
+ /// PopulateLanguageMap methods of all plugins.
+ void PopulateLanguageMap(LanguageMap& langMap);
+
+ /// PopulateCompilationGraph - Populates the compilation graph by
+ /// calling PopulateCompilationGraph methods of all plugins.
+ void PopulateCompilationGraph(CompilationGraph& tools);
+
+}
+
+#endif // LLVM_TOOLS_LLVMC2_PLUGIN_H