diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-03-12 12:35:53 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-03-13 11:08:13 +0100 |
commit | 3df0d6e3e161a63282e58f31b197c2d1ba28a6b5 (patch) | |
tree | 5f5155eb49437583850e34fdcf38a4145a5df40e /compilerplugins/clang/sharedvisitor | |
parent | 6d9b2713b100d7f158d01a9f7eb22072dc014f00 (diff) |
warn if sharedvisitor generator cannot find code in a source file
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 <l.lunak@collabora.com>
Diffstat (limited to 'compilerplugins/clang/sharedvisitor')
-rw-r--r-- | compilerplugins/clang/sharedvisitor/generator.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
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 ) { |