update credits
[LibreOffice.git] / compilerplugins / clang / pluginhandler.hxx
blobef960d1ff2b500f0a7c1afea287ec2c8a00f43d4
1 /*
2 * This file is part of the LibreOffice project.
4 * Based on LLVM/Clang.
6 * This file is distributed under the University of Illinois Open Source
7 * License. See LICENSE.TXT for details.
9 */
11 #ifndef PLUGINHANDLER_H
12 #define PLUGINHANDLER_H
14 #include "plugin.hxx"
16 #include <clang/AST/ASTConsumer.h>
17 #include <clang/Frontend/FrontendAction.h>
19 namespace loplugin
22 /**
23 Class that manages all LO modules.
25 class PluginHandler
26 : public ASTConsumer
28 public:
29 PluginHandler( CompilerInstance& compiler, const vector< string >& args );
30 virtual ~PluginHandler();
31 virtual void HandleTranslationUnit( ASTContext& context ) override;
32 static void registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter );
33 private:
34 void handleOption( const string& option );
35 void createPlugin( const string& name );
36 DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc = SourceLocation());
37 CompilerInstance& compiler;
38 Rewriter rewriter;
39 string scope;
42 /**
43 The Clang plugin class, just forwards to PluginHandler.
45 class LibreOfficeAction
46 : public PluginASTAction
48 public:
49 virtual ASTConsumer* CreateASTConsumer( CompilerInstance& Compiler, StringRef InFile );
50 virtual bool ParseArgs( const CompilerInstance& CI, const vector< string >& args );
51 private:
52 vector< string > _args;
55 } // namespace
57 #endif // COMPILEPLUGIN_H