From e6c20364e715fc7b7922d4470d5c32c781f71e48 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Thu, 2 May 2013 18:17:32 +0200 Subject: add const Change-Id: I71236b9ca6300372ba00c85401cf19f6c0e7ac99 --- compilerplugins/clang/bodynotinblock.cxx | 2 +- compilerplugins/clang/bodynotinblock.hxx | 2 +- compilerplugins/clang/literalalternative.cxx | 4 ++-- compilerplugins/clang/postfixincrementfix.cxx | 2 +- compilerplugins/clang/postfixincrementfix.hxx | 2 +- compilerplugins/clang/sallogareas.cxx | 6 +++--- compilerplugins/clang/sallogareas.hxx | 4 ++-- compilerplugins/clang/store/lclstaticfix.cxx | 2 +- compilerplugins/clang/store/lclstaticfix.hxx | 2 +- compilerplugins/clang/store/removeforwardstringdecl.cxx | 2 +- compilerplugins/clang/store/removeforwardstringdecl.hxx | 2 +- compilerplugins/clang/store/tutorial/tutorial1.cxx | 2 +- compilerplugins/clang/store/tutorial/tutorial1.hxx | 2 +- compilerplugins/clang/store/tutorial/tutorial2.cxx | 4 ++-- compilerplugins/clang/store/tutorial/tutorial2.hxx | 2 +- compilerplugins/clang/store/tutorial/tutorial3.cxx | 4 ++-- compilerplugins/clang/store/tutorial/tutorial3.hxx | 2 +- compilerplugins/clang/store/unusedcode.cxx | 6 +++--- compilerplugins/clang/unusedvariablecheck.cxx | 2 +- compilerplugins/clang/unusedvariablecheck.hxx | 2 +- 20 files changed, 28 insertions(+), 28 deletions(-) diff --git a/compilerplugins/clang/bodynotinblock.cxx b/compilerplugins/clang/bodynotinblock.cxx index afd486d2bdd0..104a146eea5e 100644 --- a/compilerplugins/clang/bodynotinblock.cxx +++ b/compilerplugins/clang/bodynotinblock.cxx @@ -38,7 +38,7 @@ void BodyNotInBlock::run() TraverseDecl( compiler.getASTContext().getTranslationUnitDecl()); } -bool BodyNotInBlock::VisitFunctionDecl( FunctionDecl* declaration ) +bool BodyNotInBlock::VisitFunctionDecl( const FunctionDecl* declaration ) { if( ignoreLocation( declaration )) return true; diff --git a/compilerplugins/clang/bodynotinblock.hxx b/compilerplugins/clang/bodynotinblock.hxx index 23f76090e0e2..9c5ed784a427 100644 --- a/compilerplugins/clang/bodynotinblock.hxx +++ b/compilerplugins/clang/bodynotinblock.hxx @@ -23,7 +23,7 @@ class BodyNotInBlock public: explicit BodyNotInBlock( CompilerInstance& compiler ); virtual void run(); - bool VisitFunctionDecl( FunctionDecl* declaration ); + bool VisitFunctionDecl( const FunctionDecl* declaration ); private: typedef vector< const Stmt* > StmtParents; void traverseStatement( const Stmt* stmt, StmtParents& parents ); diff --git a/compilerplugins/clang/literalalternative.cxx b/compilerplugins/clang/literalalternative.cxx index 06ba80304979..f8564047ad01 100644 --- a/compilerplugins/clang/literalalternative.cxx +++ b/compilerplugins/clang/literalalternative.cxx @@ -25,10 +25,10 @@ public: virtual void run() { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } - bool VisitCallExpr(CallExpr * expr); + bool VisitCallExpr(const CallExpr * expr); }; -bool LiteralAlternative::VisitCallExpr(CallExpr * expr) { +bool LiteralAlternative::VisitCallExpr(const CallExpr * expr) { if (ignoreLocation(expr)) { return true; } diff --git a/compilerplugins/clang/postfixincrementfix.cxx b/compilerplugins/clang/postfixincrementfix.cxx index 0402dec2bcfb..edb31e32e92c 100644 --- a/compilerplugins/clang/postfixincrementfix.cxx +++ b/compilerplugins/clang/postfixincrementfix.cxx @@ -29,7 +29,7 @@ void PostfixIncrementFix::run() TraverseDecl( compiler.getASTContext().getTranslationUnitDecl()); } -bool PostfixIncrementFix::VisitFunctionDecl( FunctionDecl* declaration ) +bool PostfixIncrementFix::VisitFunctionDecl( const FunctionDecl* declaration ) { if( ignoreLocation( declaration )) return true; diff --git a/compilerplugins/clang/postfixincrementfix.hxx b/compilerplugins/clang/postfixincrementfix.hxx index f3afbd7f223d..d65c197a170f 100644 --- a/compilerplugins/clang/postfixincrementfix.hxx +++ b/compilerplugins/clang/postfixincrementfix.hxx @@ -23,7 +23,7 @@ class PostfixIncrementFix public: explicit PostfixIncrementFix( CompilerInstance& compiler, Rewriter& rewriter ); virtual void run(); - bool VisitFunctionDecl( FunctionDecl* declaration ); + bool VisitFunctionDecl( const FunctionDecl* declaration ); private: typedef std::vector< const Stmt* > StmtParents; void fixPostfixOperator( const CXXOperatorCallExpr* op, StmtParents& parents ); diff --git a/compilerplugins/clang/sallogareas.cxx b/compilerplugins/clang/sallogareas.cxx index 0724ca70150c..26b22a257c8c 100644 --- a/compilerplugins/clang/sallogareas.cxx +++ b/compilerplugins/clang/sallogareas.cxx @@ -37,17 +37,17 @@ void SalLogAreas::run() TraverseDecl( compiler.getASTContext().getTranslationUnitDecl()); } -bool SalLogAreas::VisitFunctionDecl( FunctionDecl* function ) +bool SalLogAreas::VisitFunctionDecl( const FunctionDecl* function ) { inFunction = function; return true; } -bool SalLogAreas::VisitCallExpr( CallExpr* call ) +bool SalLogAreas::VisitCallExpr( const CallExpr* call ) { if( ignoreLocation( call )) return true; - if( FunctionDecl* func = call->getDirectCallee()) + if( const FunctionDecl* func = call->getDirectCallee()) { // Optimize, getQualifiedNameAsString() is reportedly expensive. if( func->getNumParams() == 4 && func->getIdentifier() != NULL diff --git a/compilerplugins/clang/sallogareas.hxx b/compilerplugins/clang/sallogareas.hxx index 4b3e3664ea0a..2c0326d58037 100644 --- a/compilerplugins/clang/sallogareas.hxx +++ b/compilerplugins/clang/sallogareas.hxx @@ -25,8 +25,8 @@ class SalLogAreas public: explicit SalLogAreas( CompilerInstance& compiler ); virtual void run(); - bool VisitFunctionDecl( FunctionDecl* function ); - bool VisitCallExpr( CallExpr* call ); + bool VisitFunctionDecl( const FunctionDecl* function ); + bool VisitCallExpr( const CallExpr* call ); private: void checkArea( StringRef area, SourceLocation location ); void readLogAreas(); diff --git a/compilerplugins/clang/store/lclstaticfix.cxx b/compilerplugins/clang/store/lclstaticfix.cxx index 423a1caa4af8..01dafd5fb1ac 100644 --- a/compilerplugins/clang/store/lclstaticfix.cxx +++ b/compilerplugins/clang/store/lclstaticfix.cxx @@ -29,7 +29,7 @@ void LclStaticFix::run() TraverseDecl( compiler.getASTContext().getTranslationUnitDecl()); } -bool LclStaticFix::VisitFunctionDecl( FunctionDecl* declaration ) +bool LclStaticFix::VisitFunctionDecl( const FunctionDecl* declaration ) { if( ignoreLocation( declaration )) return true; diff --git a/compilerplugins/clang/store/lclstaticfix.hxx b/compilerplugins/clang/store/lclstaticfix.hxx index 1fc485b4c7e7..256c6dd14e0e 100644 --- a/compilerplugins/clang/store/lclstaticfix.hxx +++ b/compilerplugins/clang/store/lclstaticfix.hxx @@ -23,7 +23,7 @@ class LclStaticFix public: explicit LclStaticFix( CompilerInstance& compiler, Rewriter& rewriter ); virtual void run(); - bool VisitFunctionDecl( FunctionDecl* declaration ); + bool VisitFunctionDecl( const FunctionDecl* declaration ); }; } // namespace diff --git a/compilerplugins/clang/store/removeforwardstringdecl.cxx b/compilerplugins/clang/store/removeforwardstringdecl.cxx index 8350c777abd1..ac85e1cd3288 100644 --- a/compilerplugins/clang/store/removeforwardstringdecl.cxx +++ b/compilerplugins/clang/store/removeforwardstringdecl.cxx @@ -29,7 +29,7 @@ void RemoveForwardStringDecl::run() TraverseDecl( compiler.getASTContext().getTranslationUnitDecl()); } -bool RemoveForwardStringDecl::VisitNamespaceDecl( NamespaceDecl* declaration ) +bool RemoveForwardStringDecl::VisitNamespaceDecl( const NamespaceDecl* declaration ) { if( ignoreLocation( declaration )) return true; diff --git a/compilerplugins/clang/store/removeforwardstringdecl.hxx b/compilerplugins/clang/store/removeforwardstringdecl.hxx index b57afebe2db3..774bbc3ffb0d 100644 --- a/compilerplugins/clang/store/removeforwardstringdecl.hxx +++ b/compilerplugins/clang/store/removeforwardstringdecl.hxx @@ -23,7 +23,7 @@ class RemoveForwardStringDecl public: explicit RemoveForwardStringDecl( CompilerInstance& compiler, Rewriter& rewriter ); virtual void run(); - bool VisitNamespaceDecl( NamespaceDecl* declaration ); + bool VisitNamespaceDecl( const NamespaceDecl* declaration ); private: bool tryRemoveStringForwardDecl( const Decl* decl ); }; diff --git a/compilerplugins/clang/store/tutorial/tutorial1.cxx b/compilerplugins/clang/store/tutorial/tutorial1.cxx index 42443afa571c..09bdaec458b9 100644 --- a/compilerplugins/clang/store/tutorial/tutorial1.cxx +++ b/compilerplugins/clang/store/tutorial/tutorial1.cxx @@ -35,7 +35,7 @@ void Tutorial1::run() // This function is called for every return statement. // Returning true means to continue with examining the AST, false means to stop (just always return true). -bool Tutorial1::VisitReturnStmt( ReturnStmt* returnstmt ) +bool Tutorial1::VisitReturnStmt( const ReturnStmt* returnstmt ) { // Helper function from the LO base plugin class, call at the very beginning to ignore sources // that should not be processed (e.g. system headers). diff --git a/compilerplugins/clang/store/tutorial/tutorial1.hxx b/compilerplugins/clang/store/tutorial/tutorial1.hxx index cb56a3bf16c7..144d0dc64f36 100644 --- a/compilerplugins/clang/store/tutorial/tutorial1.hxx +++ b/compilerplugins/clang/store/tutorial/tutorial1.hxx @@ -29,7 +29,7 @@ class Tutorial1 // The function that will be called to perform the actual action. virtual void run(); // Function from Clang, it will be called for every return statement in the source. - bool VisitReturnStmt( ReturnStmt* returnstmt ); + bool VisitReturnStmt( const ReturnStmt* returnstmt ); }; } // namespace diff --git a/compilerplugins/clang/store/tutorial/tutorial2.cxx b/compilerplugins/clang/store/tutorial/tutorial2.cxx index 63131fb17544..5d78ff26332b 100644 --- a/compilerplugins/clang/store/tutorial/tutorial2.cxx +++ b/compilerplugins/clang/store/tutorial/tutorial2.cxx @@ -33,7 +33,7 @@ void Tutorial2::run() } // This function is called for every if statement. -bool Tutorial2::VisitIfStmt( IfStmt* ifstmt ) +bool Tutorial2::VisitIfStmt( const IfStmt* ifstmt ) { if( ignoreLocation( ifstmt )) return true; @@ -49,7 +49,7 @@ bool Tutorial2::VisitIfStmt( IfStmt* ifstmt ) if( isReturnFalse( ifstmt->getThen())) warn = ifstmt->getThen(); // Check if the sub-statement is '{ return false; }' - else if( CompoundStmt* compound = dyn_cast< CompoundStmt >( ifstmt->getThen())) + else if( const CompoundStmt* compound = dyn_cast< CompoundStmt >( ifstmt->getThen())) { if( compound->size() == 1 ) // one statement if( isReturnFalse( *compound->body_begin())) // check the one sub-statement diff --git a/compilerplugins/clang/store/tutorial/tutorial2.hxx b/compilerplugins/clang/store/tutorial/tutorial2.hxx index e0d31f3c245d..71cec477a81e 100644 --- a/compilerplugins/clang/store/tutorial/tutorial2.hxx +++ b/compilerplugins/clang/store/tutorial/tutorial2.hxx @@ -25,7 +25,7 @@ class Tutorial2 Tutorial2( CompilerInstance& compiler ); virtual void run(); // Will be called for every if statement. - bool VisitIfStmt( IfStmt* ifstmt ); + bool VisitIfStmt( const IfStmt* ifstmt ); private: // Helper function to check if the statement is 'return false;'. bool isReturnFalse( const Stmt* stmt ); diff --git a/compilerplugins/clang/store/tutorial/tutorial3.cxx b/compilerplugins/clang/store/tutorial/tutorial3.cxx index 95323a667452..b099f99888dc 100644 --- a/compilerplugins/clang/store/tutorial/tutorial3.cxx +++ b/compilerplugins/clang/store/tutorial/tutorial3.cxx @@ -31,7 +31,7 @@ void Tutorial3::run() TraverseDecl( compiler.getASTContext().getTranslationUnitDecl()); } -bool Tutorial3::VisitIfStmt( IfStmt* ifstmt ) +bool Tutorial3::VisitIfStmt( const IfStmt* ifstmt ) { if( ignoreLocation( ifstmt )) return true; @@ -42,7 +42,7 @@ bool Tutorial3::VisitIfStmt( IfStmt* ifstmt ) // Modify the sub-statement if it is 'return false'. modifyReturnFalse( ifstmt->getThen()); // Modify the sub-statement if it is '{ return false; }'. - if( CompoundStmt* compound = dyn_cast< CompoundStmt >( ifstmt->getThen())) + if( const CompoundStmt* compound = dyn_cast< CompoundStmt >( ifstmt->getThen())) { if( compound->size() == 1 ) // one statement modifyReturnFalse( *compound->body_begin()); diff --git a/compilerplugins/clang/store/tutorial/tutorial3.hxx b/compilerplugins/clang/store/tutorial/tutorial3.hxx index af512c1ac489..a3dd0bdd7374 100644 --- a/compilerplugins/clang/store/tutorial/tutorial3.hxx +++ b/compilerplugins/clang/store/tutorial/tutorial3.hxx @@ -26,7 +26,7 @@ class Tutorial3 Tutorial3( CompilerInstance& compiler, Rewriter& rewriter ); virtual void run(); // Will be called for every if statement. - bool VisitIfStmt( IfStmt* ifstmt ); + bool VisitIfStmt( const IfStmt* ifstmt ); private: // Helper function to check if the statement is 'return false;' and // modify it if yes. diff --git a/compilerplugins/clang/store/unusedcode.cxx b/compilerplugins/clang/store/unusedcode.cxx index d42cb6020ccd..37c626e0782f 100644 --- a/compilerplugins/clang/store/unusedcode.cxx +++ b/compilerplugins/clang/store/unusedcode.cxx @@ -30,7 +30,7 @@ class UnusedCode public: explicit UnusedCode( CompilerInstance& compiler, Rewriter& rewriter ); virtual void run(); - bool VisitFunctionDecl( FunctionDecl* declaration ); + bool VisitFunctionDecl( const FunctionDecl* declaration ); }; UnusedCode::UnusedCode( CompilerInstance& compiler, Rewriter& rewriter ) @@ -43,12 +43,12 @@ void UnusedCode::run() TraverseDecl( compiler.getASTContext().getTranslationUnitDecl()); } -bool UnusedCode::VisitFunctionDecl( FunctionDecl* declaration ) +bool UnusedCode::VisitFunctionDecl( const FunctionDecl* declaration ) { if( ignoreLocation( declaration )) return true; bool isUsed = declaration->isUsed(); - if( CXXMethodDecl* cxxmethod = dyn_cast< CXXMethodDecl >( declaration )) + if( const CXXMethodDecl* cxxmethod = dyn_cast< CXXMethodDecl >( declaration )) { if( !isUsed && cxxmethod->isVirtual()) { // Virtual methods are used also if a method they override is used. diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx index c0bf8be522c3..a0763ac2f11d 100644 --- a/compilerplugins/clang/unusedvariablecheck.cxx +++ b/compilerplugins/clang/unusedvariablecheck.cxx @@ -40,7 +40,7 @@ void UnusedVariableCheck::run() TraverseDecl( compiler.getASTContext().getTranslationUnitDecl()); } -bool UnusedVariableCheck::VisitVarDecl( VarDecl* var ) +bool UnusedVariableCheck::VisitVarDecl( const VarDecl* var ) { if( ignoreLocation( var )) return true; diff --git a/compilerplugins/clang/unusedvariablecheck.hxx b/compilerplugins/clang/unusedvariablecheck.hxx index 98df658026c5..ef14942ef679 100644 --- a/compilerplugins/clang/unusedvariablecheck.hxx +++ b/compilerplugins/clang/unusedvariablecheck.hxx @@ -23,7 +23,7 @@ class UnusedVariableCheck public: explicit UnusedVariableCheck( CompilerInstance& compiler ); virtual void run(); - bool VisitVarDecl( VarDecl* var ); + bool VisitVarDecl( const VarDecl* var ); }; } // namespace -- cgit v1.2.3