diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/ASTMutationListener.h | 1 | ||||
-rw-r--r-- | include/clang/CodeGen/CodeGenAction.h | 3 | ||||
-rw-r--r-- | include/clang/Driver/CC1Options.td | 4 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendAction.h | 4 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendOptions.h | 3 | ||||
-rw-r--r-- | include/clang/Frontend/MultiplexConsumer.h | 54 |
6 files changed, 68 insertions, 1 deletions
diff --git a/include/clang/AST/ASTMutationListener.h b/include/clang/AST/ASTMutationListener.h index e0b02b83e6..01e6180249 100644 --- a/include/clang/AST/ASTMutationListener.h +++ b/include/clang/AST/ASTMutationListener.h @@ -15,6 +15,7 @@ namespace clang { class Decl; + class DeclContext; class TagDecl; class CXXRecordDecl; class ClassTemplateDecl; diff --git a/include/clang/CodeGen/CodeGenAction.h b/include/clang/CodeGen/CodeGenAction.h index cecfcda461..b55effc6be 100644 --- a/include/clang/CodeGen/CodeGenAction.h +++ b/include/clang/CodeGen/CodeGenAction.h @@ -18,6 +18,7 @@ namespace llvm { } namespace clang { +class BackendConsumer; class CodeGenAction : public ASTFrontendAction { private: @@ -42,6 +43,8 @@ public: /// takeModule - Take the generated LLVM module, for use after the action has /// been run. The result may be null on failure. llvm::Module *takeModule(); + + BackendConsumer *BEConsumer; }; class EmitAssemblyAction : public CodeGenAction { diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 58353f11b9..d36e45d1d1 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -290,10 +290,12 @@ def o : Separate<"-o">, MetaVarName<"<path>">, HelpText<"Specify output file">; def load : Separate<"-load">, MetaVarName<"<dsopath>">, HelpText<"Load the named plugin (dynamic shared object)">; def plugin : Separate<"-plugin">, MetaVarName<"<name>">, - HelpText<"Use the named plugin action (use \"help\" to list available options)">; + HelpText<"Use the named plugin action instead of the default action (use \"help\" to list available options)">; def plugin_arg : JoinedAndSeparate<"-plugin-arg-">, MetaVarName<"<name> <arg>">, HelpText<"Pass <arg> to plugin <name>">; +def add_plugin : Separate<"-add-plugin">, MetaVarName<"<name>">, + HelpText<"Use the named plugin action in addition to the default action">; def resource_dir : Separate<"-resource-dir">, HelpText<"The directory which holds the compiler resource files">; def version : Flag<"-version">, diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h index e3551d7749..ee0863a477 100644 --- a/include/clang/Frontend/FrontendAction.h +++ b/include/clang/Frontend/FrontendAction.h @@ -52,6 +52,10 @@ class FrontendAction { CompilerInstance *Instance; friend class ASTMergeAction; +private: + ASTConsumer* CreateWrappedASTConsumer(CompilerInstance &CI, + llvm::StringRef InFile); + protected: /// @name Implementation Action Interface /// @{ diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index bf249d205e..fe953a4595 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -103,6 +103,9 @@ public: /// Arg to pass to the plugin std::vector<std::string> PluginArgs; + /// The list of plugin actions to run in addition to the normal action. + std::vector<std::string> AddPluginActions; + /// The list of plugins to load. std::vector<std::string> Plugins; diff --git a/include/clang/Frontend/MultiplexConsumer.h b/include/clang/Frontend/MultiplexConsumer.h new file mode 100644 index 0000000000..560178be9b --- /dev/null +++ b/include/clang/Frontend/MultiplexConsumer.h @@ -0,0 +1,54 @@ +//===-- MultiplexConsumer.h - AST Consumer for PCH Generation ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file declares the MultiplexConsumer class, which can be used to +// multiplex ASTConsumer and SemaConsumer messages to many consumers. +// +//===----------------------------------------------------------------------===// + +#include "clang/Sema/SemaConsumer.h" +#include "llvm/ADT/OwningPtr.h" +#include <vector> + +namespace clang { + +class MultiplexASTMutationListener; +class MultiplexASTDeserializationListener; + +// Has a list of ASTConsumers and calls each of them. Owns its children. +class MultiplexConsumer : public SemaConsumer { +public: + // Takes ownership of the pointers in C. + MultiplexConsumer(const std::vector<ASTConsumer*>& C); + ~MultiplexConsumer(); + + // ASTConsumer + virtual void Initialize(ASTContext &Context); + virtual void HandleTopLevelDecl(DeclGroupRef D); + virtual void HandleInterestingDecl(DeclGroupRef D); + virtual void HandleTranslationUnit(ASTContext &Ctx); + virtual void HandleTagDeclDefinition(TagDecl *D); + virtual void CompleteTentativeDefinition(VarDecl *D); + virtual void HandleVTable(CXXRecordDecl *RD, bool DefinitionRequired); + virtual ASTMutationListener *GetASTMutationListener(); + virtual ASTDeserializationListener *GetASTDeserializationListener(); + virtual void PrintStats(); + + // SemaConsumer + virtual void InitializeSema(Sema &S); + virtual void ForgetSema(); + + static bool classof(const MultiplexConsumer *) { return true; } +private: + std::vector<ASTConsumer*> Consumers; // Owns these. + llvm::OwningPtr<MultiplexASTMutationListener> MutationListener; + llvm::OwningPtr<MultiplexASTDeserializationListener> DeserializationListener; +}; + +} // end namespace clang |