[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 3 commits - compilerplugins/clang

Luboš Luňák l.lunak at suse.cz
Thu Jun 13 11:48:24 PDT 2013


 compilerplugins/clang/bodynotinblock.hxx                |    2 
 compilerplugins/clang/checkconfigmacros.cxx             |   45 +++++++++++++---
 compilerplugins/clang/literalalternative.cxx            |    2 
 compilerplugins/clang/pluginhandler.hxx                 |    2 
 compilerplugins/clang/postfixincrementfix.hxx           |    2 
 compilerplugins/clang/rtlconstasciimacro.cxx            |   14 ++++
 compilerplugins/clang/sallogareas.hxx                   |    2 
 compilerplugins/clang/store/lclstaticfix.hxx            |    2 
 compilerplugins/clang/store/removeforwardstringdecl.hxx |    2 
 compilerplugins/clang/store/tutorial/tutorial1.hxx      |    2 
 compilerplugins/clang/store/tutorial/tutorial2.hxx      |    2 
 compilerplugins/clang/store/tutorial/tutorial3.hxx      |    2 
 compilerplugins/clang/store/unusedcode.cxx              |    2 
 compilerplugins/clang/unusedvariablecheck.hxx           |    2 
 14 files changed, 62 insertions(+), 21 deletions(-)

New commits:
commit 9ed785e9af383af2414387196869a95b3919a51d
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Sun Jun 2 16:30:52 2013 +0200

    fix plugin build with clang < 3.3
    
    Change-Id: If2eb7595ca7d25f6d491e332bb3060061d3b42a7

diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index 8524d7b..86b7e43 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -32,7 +32,7 @@ class CheckConfigMacros
     public:
         explicit CheckConfigMacros( CompilerInstance& compiler );
         virtual void run() override;
-#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3
         virtual void MacroDefined( const Token& macroToken, const MacroInfo* info ) override;
         virtual void MacroUndefined( const Token& macroToken, const MacroInfo* info ) override;
         virtual void Ifdef( SourceLocation location, const Token& macroToken ) override;
@@ -61,7 +61,7 @@ void CheckConfigMacros::run()
     // nothing, only check preprocessor usage
     }
 
-#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3
 void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroInfo* info )
     {
     SourceLocation location = info->getDefinitionLoc();
@@ -80,7 +80,7 @@ void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirect
         }
     }
 
-#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3
 void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroInfo* )
 #else
 void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDirective* )
@@ -89,7 +89,7 @@ void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDire
     configMacros.erase( macroToken.getIdentifierInfo()->getName());
     }
 
-#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3
 void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken )
 #else
 void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, const MacroDirective* )
@@ -98,7 +98,7 @@ void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken,
     checkMacro( macroToken, location );
     }
 
-#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3
 void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken )
 #else
 void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, const MacroDirective* )
@@ -107,7 +107,7 @@ void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken
     checkMacro( macroToken, location );
     }
 
-#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3
 void CheckConfigMacros::Defined( const Token& macroToken )
 #else
 void CheckConfigMacros::Defined( const Token& macroToken, const MacroDirective* )
commit eb437a7afb5465eccc70fb65b80445c53d9a8f90
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri May 31 18:50:15 2013 +0200

    update for PPCallbacks API changes in Clang3.3
    
    Change-Id: I8493afa8e2264a42fba090c9c72f36f36cb2d165

diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index 3a22045..8524d7b 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -32,11 +32,19 @@ class CheckConfigMacros
     public:
         explicit CheckConfigMacros( CompilerInstance& compiler );
         virtual void run() override;
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
         virtual void MacroDefined( const Token& macroToken, const MacroInfo* info ) override;
-        virtual void MacroUndefined( const Token& macroToken , const MacroInfo* info ) override;
+        virtual void MacroUndefined( const Token& macroToken, const MacroInfo* info ) override;
         virtual void Ifdef( SourceLocation location, const Token& macroToken ) override;
         virtual void Ifndef( SourceLocation location, const Token& macroToken ) override;
         virtual void Defined( const Token& macroToken ) override;
+#else
+        virtual void MacroDefined( const Token& macroToken, const MacroDirective* info ) override;
+        virtual void MacroUndefined( const Token& macroToken, const MacroDirective* info ) override;
+        virtual void Ifdef( SourceLocation location, const Token& macroToken, const MacroDirective* info ) override;
+        virtual void Ifndef( SourceLocation location, const Token& macroToken, const MacroDirective* info ) override;
+        virtual void Defined( const Token& macroToken, const MacroDirective* info ) override;
+#endif
     private:
         void checkMacro( const Token& macroToken, SourceLocation location );
         std::set< string > configMacros;
@@ -53,9 +61,16 @@ void CheckConfigMacros::run()
     // nothing, only check preprocessor usage
     }
 
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
 void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroInfo* info )
     {
-    const char* filename = compiler.getSourceManager().getPresumedLoc( info->getDefinitionLoc()).getFilename();
+    SourceLocation location = info->getDefinitionLoc();
+#else
+void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirective* info )
+    {
+    SourceLocation location = info->getLocation();
+#endif
+    const char* filename = compiler.getSourceManager().getPresumedLoc( location ).getFilename();
     if( filename != NULL
         && ( strncmp( filename, BUILDDIR "/config_host/", strlen( BUILDDIR "/config_host/" )) == 0
             || strncmp( filename, BUILDDIR "/config_build/", strlen( BUILDDIR "/config_build/" )) == 0 ))
@@ -65,22 +80,38 @@ void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroInfo*
         }
     }
 
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
 void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroInfo* )
+#else
+void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDirective* )
+#endif
     {
     configMacros.erase( macroToken.getIdentifierInfo()->getName());
     }
 
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
 void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken )
+#else
+void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, const MacroDirective* )
+#endif
     {
     checkMacro( macroToken, location );
     }
 
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
 void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken )
+#else
+void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, const MacroDirective* )
+#endif
     {
     checkMacro( macroToken, location );
     }
 
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
 void CheckConfigMacros::Defined( const Token& macroToken )
+#else
+void CheckConfigMacros::Defined( const Token& macroToken, const MacroDirective* )
+#endif
     {
     checkMacro( macroToken, macroToken.getLocation());
     }
diff --git a/compilerplugins/clang/rtlconstasciimacro.cxx b/compilerplugins/clang/rtlconstasciimacro.cxx
index 331401a..d384314 100644
--- a/compilerplugins/clang/rtlconstasciimacro.cxx
+++ b/compilerplugins/clang/rtlconstasciimacro.cxx
@@ -33,7 +33,12 @@ class RtlConstAsciiMacro
         bool VisitCXXConstructExpr( CXXConstructExpr* expr );
         bool VisitCXXTemporaryObjectExpr( CXXTemporaryObjectExpr* expr );
         bool VisitStringLiteral( const StringLiteral* literal );
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3
         virtual void MacroExpands( const Token& macro, const MacroInfo* info, SourceRange range ) override;
+#else
+        virtual void MacroExpands( const Token& macro, const MacroDirective* directive,
+            SourceRange range, const MacroArgs* args ) override;
+#endif
     private:
         map< SourceLocation, SourceLocation > expansions; // start location -> end location
         bool searchingForString;
@@ -53,7 +58,12 @@ void RtlConstAsciiMacro::run()
     }
 
 
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3
 void RtlConstAsciiMacro::MacroExpands( const Token& macro, const MacroInfo*, SourceRange range )
+#else
+void RtlConstAsciiMacro::MacroExpands( const Token& macro, const MacroDirective*,
+    SourceRange range, const MacroArgs* )
+#endif
     {
     if( macro.getIdentifierInfo()->getName() != "RTL_CONSTASCII_USTRINGPARAM" )
         return;
commit 681ee40d19baed0ab91bef338084ddf849746f5f
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri May 31 18:34:11 2013 +0200

    mark all virtuals in the clang plugin as override
    
    In order to help catch Clang API changes.
    
    Conflicts:
    	compilerplugins/clang/store/referencecasting.hxx
    
    Change-Id: I5738f5dff405f7a2dd377c983fb32c1c7a2ff921

diff --git a/compilerplugins/clang/bodynotinblock.hxx b/compilerplugins/clang/bodynotinblock.hxx
index 9c5ed78..e6ad1ab 100644
--- a/compilerplugins/clang/bodynotinblock.hxx
+++ b/compilerplugins/clang/bodynotinblock.hxx
@@ -22,7 +22,7 @@ class BodyNotInBlock
     {
     public:
         explicit BodyNotInBlock( CompilerInstance& compiler );
-        virtual void run();
+        virtual void run() override;
         bool VisitFunctionDecl( const FunctionDecl* declaration );
     private:
         typedef vector< const Stmt* > StmtParents;
diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index 3ffaff8..3a22045 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -31,12 +31,12 @@ class CheckConfigMacros
     {
     public:
         explicit CheckConfigMacros( CompilerInstance& compiler );
-        virtual void run();
-        virtual void MacroDefined( const Token& macroToken, const MacroInfo* info );
-        virtual void MacroUndefined( const Token& macroToken , const MacroInfo* info );
-        virtual void Ifdef( SourceLocation location, const Token& macroToken );
-        virtual void Ifndef( SourceLocation location, const Token& macroToken );
-        virtual void Defined( const Token& macroToken );
+        virtual void run() override;
+        virtual void MacroDefined( const Token& macroToken, const MacroInfo* info ) override;
+        virtual void MacroUndefined( const Token& macroToken , const MacroInfo* info ) override;
+        virtual void Ifdef( SourceLocation location, const Token& macroToken ) override;
+        virtual void Ifndef( SourceLocation location, const Token& macroToken ) override;
+        virtual void Defined( const Token& macroToken ) override;
     private:
         void checkMacro( const Token& macroToken, SourceLocation location );
         std::set< string > configMacros;
diff --git a/compilerplugins/clang/literalalternative.cxx b/compilerplugins/clang/literalalternative.cxx
index f856404..4d2711c 100644
--- a/compilerplugins/clang/literalalternative.cxx
+++ b/compilerplugins/clang/literalalternative.cxx
@@ -23,7 +23,7 @@ class LiteralAlternative:
 public:
     explicit LiteralAlternative(CompilerInstance & compiler): Plugin(compiler) {}
 
-    virtual void run() { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
+    virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
 
     bool VisitCallExpr(const CallExpr * expr);
 };
diff --git a/compilerplugins/clang/pluginhandler.hxx b/compilerplugins/clang/pluginhandler.hxx
index fcba582..ef960d1f 100644
--- a/compilerplugins/clang/pluginhandler.hxx
+++ b/compilerplugins/clang/pluginhandler.hxx
@@ -28,7 +28,7 @@ class PluginHandler
     public:
         PluginHandler( CompilerInstance& compiler, const vector< string >& args );
         virtual ~PluginHandler();
-        virtual void HandleTranslationUnit( ASTContext& context );
+        virtual void HandleTranslationUnit( ASTContext& context ) override;
         static void registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter );
     private:
         void handleOption( const string& option );
diff --git a/compilerplugins/clang/postfixincrementfix.hxx b/compilerplugins/clang/postfixincrementfix.hxx
index d65c197..29756cf 100644
--- a/compilerplugins/clang/postfixincrementfix.hxx
+++ b/compilerplugins/clang/postfixincrementfix.hxx
@@ -22,7 +22,7 @@ class PostfixIncrementFix
     {
     public:
         explicit PostfixIncrementFix( CompilerInstance& compiler, Rewriter& rewriter );
-        virtual void run();
+        virtual void run() override;
         bool VisitFunctionDecl( const FunctionDecl* declaration );
     private:
         typedef std::vector< const Stmt* > StmtParents;
diff --git a/compilerplugins/clang/rtlconstasciimacro.cxx b/compilerplugins/clang/rtlconstasciimacro.cxx
index f1a9d02..331401a 100644
--- a/compilerplugins/clang/rtlconstasciimacro.cxx
+++ b/compilerplugins/clang/rtlconstasciimacro.cxx
@@ -29,11 +29,11 @@ class RtlConstAsciiMacro
     {
     public:
         explicit RtlConstAsciiMacro( CompilerInstance& compiler, Rewriter& rewriter );
-        virtual void run();
+        virtual void run() override;
         bool VisitCXXConstructExpr( CXXConstructExpr* expr );
         bool VisitCXXTemporaryObjectExpr( CXXTemporaryObjectExpr* expr );
         bool VisitStringLiteral( const StringLiteral* literal );
-        virtual void MacroExpands( const Token& macro, const MacroInfo* info, SourceRange range );
+        virtual void MacroExpands( const Token& macro, const MacroInfo* info, SourceRange range ) override;
     private:
         map< SourceLocation, SourceLocation > expansions; // start location -> end location
         bool searchingForString;
diff --git a/compilerplugins/clang/sallogareas.hxx b/compilerplugins/clang/sallogareas.hxx
index 2c0326d..e00086b 100644
--- a/compilerplugins/clang/sallogareas.hxx
+++ b/compilerplugins/clang/sallogareas.hxx
@@ -24,7 +24,7 @@ class SalLogAreas
     {
     public:
         explicit SalLogAreas( CompilerInstance& compiler );
-        virtual void run();
+        virtual void run() override;
         bool VisitFunctionDecl( const FunctionDecl* function );
         bool VisitCallExpr( const CallExpr* call );
     private:
diff --git a/compilerplugins/clang/store/lclstaticfix.hxx b/compilerplugins/clang/store/lclstaticfix.hxx
index 256c6dd..48e9c66 100644
--- a/compilerplugins/clang/store/lclstaticfix.hxx
+++ b/compilerplugins/clang/store/lclstaticfix.hxx
@@ -22,7 +22,7 @@ class LclStaticFix
     {
     public:
         explicit LclStaticFix( CompilerInstance& compiler, Rewriter& rewriter );
-        virtual void run();
+        virtual void run() override;
         bool VisitFunctionDecl( const FunctionDecl* declaration );
     };
 
diff --git a/compilerplugins/clang/store/removeforwardstringdecl.hxx b/compilerplugins/clang/store/removeforwardstringdecl.hxx
index 774bbc3..552aa4d 100644
--- a/compilerplugins/clang/store/removeforwardstringdecl.hxx
+++ b/compilerplugins/clang/store/removeforwardstringdecl.hxx
@@ -22,7 +22,7 @@ class RemoveForwardStringDecl
     {
     public:
         explicit RemoveForwardStringDecl( CompilerInstance& compiler, Rewriter& rewriter );
-        virtual void run();
+        virtual void run() override;
         bool VisitNamespaceDecl( const NamespaceDecl* declaration );
     private:
         bool tryRemoveStringForwardDecl( const Decl* decl );
diff --git a/compilerplugins/clang/store/tutorial/tutorial1.hxx b/compilerplugins/clang/store/tutorial/tutorial1.hxx
index 144d0dc..bb5fe2e 100644
--- a/compilerplugins/clang/store/tutorial/tutorial1.hxx
+++ b/compilerplugins/clang/store/tutorial/tutorial1.hxx
@@ -27,7 +27,7 @@ class Tutorial1
         // Ctor, nothing special.
         Tutorial1( CompilerInstance& compiler );
         // The function that will be called to perform the actual action.
-        virtual void run();
+        virtual void run() override;
         // Function from Clang, it will be called for every return statement in the source.
         bool VisitReturnStmt( const ReturnStmt* returnstmt );
     };
diff --git a/compilerplugins/clang/store/tutorial/tutorial2.hxx b/compilerplugins/clang/store/tutorial/tutorial2.hxx
index 71cec47..4fa6232 100644
--- a/compilerplugins/clang/store/tutorial/tutorial2.hxx
+++ b/compilerplugins/clang/store/tutorial/tutorial2.hxx
@@ -23,7 +23,7 @@ class Tutorial2
     {
     public:
         Tutorial2( CompilerInstance& compiler );
-        virtual void run();
+        virtual void run() override;
         // Will be called for every if statement.
         bool VisitIfStmt( const IfStmt* ifstmt );
     private:
diff --git a/compilerplugins/clang/store/tutorial/tutorial3.hxx b/compilerplugins/clang/store/tutorial/tutorial3.hxx
index a3dd0bd..b82f149 100644
--- a/compilerplugins/clang/store/tutorial/tutorial3.hxx
+++ b/compilerplugins/clang/store/tutorial/tutorial3.hxx
@@ -24,7 +24,7 @@ class Tutorial3
     public:
         // One more argument for ctor.
         Tutorial3( CompilerInstance& compiler, Rewriter& rewriter );
-        virtual void run();
+        virtual void run() override;
         // Will be called for every if statement.
         bool VisitIfStmt( const IfStmt* ifstmt );
     private:
diff --git a/compilerplugins/clang/store/unusedcode.cxx b/compilerplugins/clang/store/unusedcode.cxx
index 37c626e..ed5b2ea 100644
--- a/compilerplugins/clang/store/unusedcode.cxx
+++ b/compilerplugins/clang/store/unusedcode.cxx
@@ -29,7 +29,7 @@ class UnusedCode
     {
     public:
         explicit UnusedCode( CompilerInstance& compiler, Rewriter& rewriter );
-        virtual void run();
+        virtual void run() override;
         bool VisitFunctionDecl( const FunctionDecl* declaration );
     };
 
diff --git a/compilerplugins/clang/unusedvariablecheck.hxx b/compilerplugins/clang/unusedvariablecheck.hxx
index ef14942..695971e 100644
--- a/compilerplugins/clang/unusedvariablecheck.hxx
+++ b/compilerplugins/clang/unusedvariablecheck.hxx
@@ -22,7 +22,7 @@ class UnusedVariableCheck
     {
     public:
         explicit UnusedVariableCheck( CompilerInstance& compiler );
-        virtual void run();
+        virtual void run() override;
         bool VisitVarDecl( const VarDecl* var );
     };
 


More information about the Libreoffice-commits mailing list