[Libreoffice-commits] core.git: compilerplugins/clang

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Mar 13 10:08:42 UTC 2019


 compilerplugins/clang/sharedvisitor/generator.cxx |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 3df0d6e3e161a63282e58f31b197c2d1ba28a6b5
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Mar 12 12:35:53 2019 +0100
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Mar 13 11:08:13 2019 +0100

    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 at collabora.com>

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 )
     {


More information about the Libreoffice-commits mailing list