From 3df0d6e3e161a63282e58f31b197c2d1ba28a6b5 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Tue, 12 Mar 2019 12:35:53 +0100 Subject: warn if sharedvisitor generator cannot find code in a source file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just in case there's a typo or something, without this that source would not be compiled but shared visitor would not include that functionality either. Change-Id: I5d9fad129b83f24fed2613bc071cb33e149c1db3 Reviewed-on: https://gerrit.libreoffice.org/69093 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- compilerplugins/clang/sharedvisitor/generator.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'compilerplugins/clang/sharedvisitor') diff --git a/compilerplugins/clang/sharedvisitor/generator.cxx b/compilerplugins/clang/sharedvisitor/generator.cxx index c714c0cc69db..bd957a903ee6 100644 --- a/compilerplugins/clang/sharedvisitor/generator.cxx +++ b/compilerplugins/clang/sharedvisitor/generator.cxx @@ -393,6 +393,8 @@ static TraverseFunctionInfo findOrCreateTraverseFunctionInfo( PluginInfo& plugin return info; } +static bool foundSomething; + bool CheckFileVisitor::VisitCXXRecordDecl( CXXRecordDecl* decl ) { if( !isDerivedFrom( decl, inheritsPluginClassCheck )) @@ -477,6 +479,8 @@ bool CheckFileVisitor::VisitCXXRecordDecl( CXXRecordDecl* decl ) plugins[ PluginVisitImplicit ].push_back( move( pluginInfo )); else plugins[ PluginBasic ].push_back( move( pluginInfo )); + + foundSomething = true; return true; } @@ -547,11 +551,18 @@ int main(int argc, char** argv) "-D__STDC_FORMAT_MACROS", "-D__STDC_LIMIT_MACROS", }; + foundSomething = false; if( !clang::tooling::runToolOnCodeWithArgs( new FindNamedClassAction, contents, args, argv[ i ] )) { cerr << "Failed to analyze: " << argv[ i ] << endl; return 2; } + if( !foundSomething ) + { + // there's #ifndef LO_CLANG_SHARED_PLUGINS in the source, but no class matched + cerr << "Failed to find code: " << argv[ i ] << endl; + return 2; + } } for( int type = Plugin_Begin; type < Plugin_End; ++type ) { -- cgit