1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
7 * This file is distributed under the University of Illinois Open Source
8 * License. See LICENSE.TXT for details.
12 #ifndef PLUGINHANDLER_H
13 #define PLUGINHANDLER_H
19 #include <clang/AST/ASTConsumer.h>
20 #include <clang/Frontend/FrontendAction.h>
26 Class that manages all LO modules.
32 PluginHandler( CompilerInstance
& compiler
, const vector
< string
>& args
);
33 virtual ~PluginHandler();
34 virtual void HandleTranslationUnit( ASTContext
& context
) override
;
35 static void registerPlugin( Plugin
* (*create
)( const Plugin::InstantiationData
& ), const char* optionName
, bool isPPCallback
, bool byDefault
);
36 DiagnosticBuilder
report( DiagnosticsEngine::Level level
, const char * plugin
, StringRef message
,
37 CompilerInstance
& compiler
, SourceLocation loc
= SourceLocation());
38 bool addRemoval( SourceLocation loc
);
40 void handleOption( const string
& option
);
41 void createPlugins( set
< string
> rewriters
);
42 DiagnosticBuilder
report( DiagnosticsEngine::Level level
, StringRef message
, SourceLocation loc
= SourceLocation());
43 CompilerInstance
& compiler
;
45 set
< SourceLocation
> removals
;
48 bool warningsAsErrors
;
52 The Clang plugin class, just forwards to PluginHandler.
54 class LibreOfficeAction
55 : public PluginASTAction
58 #if CLANG_VERSION >= 30600
59 virtual std::unique_ptr
<ASTConsumer
> CreateASTConsumer( CompilerInstance
& Compiler
, StringRef InFile
);
61 virtual ASTConsumer
* CreateASTConsumer( CompilerInstance
& Compiler
, StringRef InFile
);
64 virtual bool ParseArgs( const CompilerInstance
& CI
, const vector
< string
>& args
);
66 vector
< string
> _args
;
71 #endif // COMPILEPLUGIN_H
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */