aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Frontend
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-15 00:12:04 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-15 00:12:04 +0000
commitd10c5b88334d860d19284032a7126dc2219f57ed (patch)
tree2bccfc61c3879c2b980bcafb2926f07ddeae7a1a /include/clang/Frontend
parentcbcd4e5d9d4c6148d47c6c05038b295c1eb037b2 (diff)
Add pluggable action support to clang-cc, via -plugin command line option.
- Expects the plugin has been loaded with -load. - Using this may require disabling TOOL_NO_EXPORTS in the clang-cc Makefile, this breaks the llvm::Registry way of working (static constructors are bad, kids). This should be replaced with a "real" plugin model that has explicit plugin interfaces. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88824 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend')
-rw-r--r--include/clang/Frontend/FrontendOptions.h5
-rw-r--r--include/clang/Frontend/FrontendPluginRegistry.h23
2 files changed, 28 insertions, 0 deletions
diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h
index adb591ee06..67656067fc 100644
--- a/include/clang/Frontend/FrontendOptions.h
+++ b/include/clang/Frontend/FrontendOptions.h
@@ -39,6 +39,7 @@ namespace frontend {
ParseNoop, ///< Parse with noop callbacks.
ParsePrintCallbacks, ///< Parse and print each callback.
ParseSyntaxOnly, ///< Parse and perform semantic analysis.
+ PluginAction, ///< Run a plugin action, \see ActionName.
PrintDeclContext, ///< Print DeclContext and their Decls.
PrintPreprocessedInput, ///< -E mode.
RewriteBlocks, ///< ObjC->C Rewriter for Blocks.
@@ -109,12 +110,16 @@ public:
/// The frontend action to perform.
frontend::ActionKind ProgramAction;
+ /// The name of the action to run when using a plugin action.
+ std::string ActionName;
+
public:
FrontendOptions() {
DebugCodeCompletionPrinter = 0;
DisableFree = 0;
EmptyInputOnly = 0;
ProgramAction = frontend::ParseSyntaxOnly;
+ ActionName = "";
RelocatablePCH = 0;
ShowMacrosInCodeCompletion = 0;
ShowStats = 0;
diff --git a/include/clang/Frontend/FrontendPluginRegistry.h b/include/clang/Frontend/FrontendPluginRegistry.h
new file mode 100644
index 0000000000..8341492cfd
--- /dev/null
+++ b/include/clang/Frontend/FrontendPluginRegistry.h
@@ -0,0 +1,23 @@
+//===-- FrontendAction.h - Pluggable Frontend Action Interface --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_FRONTEND_PLUGINFRONTENDACTION_H
+#define LLVM_CLANG_FRONTEND_PLUGINFRONTENDACTION_H
+
+#include "clang/Frontend/FrontendAction.h"
+#include "llvm/Support/Registry.h"
+
+namespace clang {
+
+/// The frontend plugin registry.
+typedef llvm::Registry<FrontendAction> FrontendPluginRegistry;
+
+} // end namespace clang
+
+#endif