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
;
51 The Clang plugin class, just forwards to PluginHandler.
53 class LibreOfficeAction
54 : public PluginASTAction
57 #if (__clang_major__ == 3 && __clang_minor__ >= 6) || __clang_major__ > 3
58 virtual std::unique_ptr
<ASTConsumer
> CreateASTConsumer( CompilerInstance
& Compiler
, StringRef InFile
);
60 virtual ASTConsumer
* CreateASTConsumer( CompilerInstance
& Compiler
, StringRef InFile
);
63 virtual bool ParseArgs( const CompilerInstance
& CI
, const vector
< string
>& args
);
65 vector
< string
> _args
;
70 #endif // COMPILEPLUGIN_H
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */