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/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 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'compilerplugins/clang/store/tutorial') 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. -- cgit v1.2.3