2012-10-09 09:21:33 -05:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* Based on LLVM/Clang.
|
|
|
|
*
|
|
|
|
* This file is distributed under the University of Illinois Open Source
|
|
|
|
* License. See LICENSE.TXT for details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BODYNOTINBLOCK_H
|
|
|
|
#define BODYNOTINBLOCK_H
|
|
|
|
|
2012-10-15 08:36:25 -05:00
|
|
|
#include "plugin.hxx"
|
2012-10-09 09:21:33 -05:00
|
|
|
|
|
|
|
namespace loplugin
|
|
|
|
{
|
|
|
|
|
|
|
|
class BodyNotInBlock
|
|
|
|
: public RecursiveASTVisitor< BodyNotInBlock >
|
2012-10-09 09:27:25 -05:00
|
|
|
, public Plugin
|
2012-10-09 09:21:33 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit BodyNotInBlock( ASTContext& context );
|
2013-02-02 10:45:18 -06:00
|
|
|
virtual void run();
|
2012-10-09 09:21:33 -05:00
|
|
|
bool VisitFunctionDecl( FunctionDecl* declaration );
|
|
|
|
private:
|
2012-10-15 07:58:19 -05:00
|
|
|
typedef vector< const Stmt* > StmtParents;
|
2012-10-09 09:21:33 -05:00
|
|
|
void traverseStatement( const Stmt* stmt, StmtParents& parents );
|
2012-11-20 09:26:53 -06:00
|
|
|
void checkBody( const Stmt* body, SourceLocation stmtLocation, const StmtParents& parents,
|
|
|
|
int stmtType, bool dontGoUp = false );
|
2012-10-09 09:21:33 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif // BODYNOTINBLOCK_H
|