| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef SIMPLIFY_IF_H |
| 12 |
#define SIMPLIFY_IF_H |
| 13 |
|
| 14 |
#include <string> |
| 15 |
#include "Transformation.h" |
| 16 |
|
| 17 |
namespace clang { |
| 18 |
class DeclGroupRef; |
| 19 |
class ASTContext; |
| 20 |
class Stmt; |
| 21 |
class IfStmt; |
| 22 |
} |
| 23 |
|
| 24 |
class SimplifyIfCollectionVisitor; |
| 25 |
class SimplifyIfStatementVisitor; |
| 26 |
|
| 27 |
class SimplifyIf : public Transformation { |
| 28 |
friend class SimplifyIfCollectionVisitor; |
| 29 |
friend class SimplifyIfStatementVisitor; |
| 30 |
|
| 31 |
public: |
| 32 |
|
| 33 |
SimplifyIf(const char *TransName, const char *Desc) |
| 34 |
: Transformation(TransName, Desc), |
| 35 |
CollectionVisitor(NULL), |
| 36 |
StmtVisitor(NULL), |
| 37 |
TheIfStmt(NULL), |
| 38 |
NeedParen(false) |
| 39 |
{ } |
| 40 |
|
| 41 |
~SimplifyIf(void); |
| 42 |
|
| 43 |
private: |
| 44 |
|
| 45 |
virtual void Initialize(clang::ASTContext &context); |
| 46 |
|
| 47 |
virtual bool HandleTopLevelDecl(clang::DeclGroupRef D); |
| 48 |
|
| 49 |
virtual void HandleTranslationUnit(clang::ASTContext &Ctx); |
| 50 |
|
| 51 |
void simplifyIfStmt(void); |
| 52 |
|
| 53 |
SimplifyIfCollectionVisitor *CollectionVisitor; |
| 54 |
|
| 55 |
SimplifyIfStatementVisitor *StmtVisitor; |
| 56 |
|
| 57 |
clang::IfStmt *TheIfStmt; |
| 58 |
|
| 59 |
bool NeedParen; |
| 60 |
|
| 61 |
|
| 62 |
SimplifyIf(void); |
| 63 |
|
| 64 |
SimplifyIf(const SimplifyIf &); |
| 65 |
|
| 66 |
void operator=(const SimplifyIf &); |
| 67 |
}; |
| 68 |
#endif |