2013-09-21 14:42:35 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-10-09 16:21:33 +02: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 15:36:25 +02:00
|
|
|
#include "plugin.hxx"
|
2012-10-09 16:21:33 +02:00
|
|
|
|
|
|
|
namespace loplugin
|
|
|
|
{
|
|
|
|
|
|
|
|
class BodyNotInBlock
|
|
|
|
: public RecursiveASTVisitor< BodyNotInBlock >
|
2012-10-09 16:27:25 +02:00
|
|
|
, public Plugin
|
2012-10-09 16:21:33 +02:00
|
|
|
{
|
|
|
|
public:
|
2014-01-27 13:09:20 +01:00
|
|
|
explicit BodyNotInBlock( const InstantiationData& data );
|
2013-05-31 18:34:11 +02:00
|
|
|
virtual void run() override;
|
2013-06-20 01:17:58 +02:00
|
|
|
bool VisitIfStmt( const IfStmt* stmt );
|
|
|
|
bool VisitWhileStmt( const WhileStmt* stmt );
|
|
|
|
bool VisitForStmt( const ForStmt* stmt );
|
|
|
|
bool VisitCXXForRangeStmt( const CXXForRangeStmt* stmt );
|
2012-10-09 16:21:33 +02:00
|
|
|
private:
|
2012-10-15 14:58:19 +02:00
|
|
|
typedef vector< const Stmt* > StmtParents;
|
2013-06-20 01:17:58 +02:00
|
|
|
void checkBody( const Stmt* body, SourceLocation stmtLocation, int stmtType, bool dontGoUp = false );
|
2012-10-09 16:21:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif // BODYNOTINBLOCK_H
|
2013-09-21 14:42:35 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|