significantly reduce build time of sharedvisitor.cxx

In the sharedvisitor.cxx mode all plugins need just one shared
RecursiveASTVisitor template instance, but as long as they use another
instance each as the base class, Clang still instantiates those templates
and then spends a lot of time optimizing each of them, even though they
should never get used.
So when compiling using sharedvisitor.cxx simply use dummy base classes
that do not do anything. As an additional check they abort() if any
of the functions get called, this needed removing vclwidgets and
unusedmember from shared plugins, because they call TraverseStmt(),
maybe this can get handled somehow later.

Change-Id: Ic5a350da2c3ba31521f71077b1776b1ee8f06dea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87561
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
Luboš Luňák
2020-01-27 22:25:13 +01:00
parent 0528012fd0
commit 81bd3b4a85
6 changed files with 89 additions and 9 deletions

View File

@@ -146,7 +146,11 @@ void PluginHandler::createPlugins( std::set< std::string > rewriters )
const char* name = plugins[i].optionName;
// When in unit-test mode, ignore plugins whose names don't match the filename of the test,
// so that we only generate warnings for the plugin that we want to test.
if (unitTestMode && mainFileName.find(plugins[ i ].optionName) == StringRef::npos)
// Sharedvisitor plugins still need to remain enabled, they don't do anything on their own,
// but sharing-capable plugins need them to actually work (if compiled so) and they register
// with them in the code below.
if (unitTestMode && mainFileName.find(plugins[ i ].optionName) == StringRef::npos
&& !plugins[ i ].isSharedPlugin)
continue;
if( rewriters.erase( name ) != 0 )
plugins[ i ].object = plugins[ i ].create( InstantiationData { name, *this, compiler, &rewriter } );