| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef COMBINE_LOCAL_VAR_DECL_H |
| 12 |
#define COMBINE_LOCAL_VAR_DECL_H |
| 13 |
|
| 14 |
#include <string> |
| 15 |
#include "llvm/ADT/SmallVector.h" |
| 16 |
#include "llvm/ADT/DenseMap.h" |
| 17 |
#include "Transformation.h" |
| 18 |
|
| 19 |
namespace clang { |
| 20 |
class DeclGroupRef; |
| 21 |
class ASTContext; |
| 22 |
class DeclStmt; |
| 23 |
class CompoundStmt; |
| 24 |
class Type; |
| 25 |
} |
| 26 |
|
| 27 |
class CombLocalVarCollectionVisitor; |
| 28 |
class CombineLocalVarDecl : public Transformation { |
| 29 |
friend class CombLocalVarCollectionVisitor; |
| 30 |
|
| 31 |
public: |
| 32 |
|
| 33 |
CombineLocalVarDecl(const char *TransName, const char *Desc) |
| 34 |
: Transformation(TransName, Desc), |
| 35 |
CollectionVisitor(NULL) |
| 36 |
{ } |
| 37 |
|
| 38 |
~CombineLocalVarDecl(void); |
| 39 |
|
| 40 |
private: |
| 41 |
|
| 42 |
virtual void Initialize(clang::ASTContext &context); |
| 43 |
|
| 44 |
virtual bool HandleTopLevelDecl(clang::DeclGroupRef D); |
| 45 |
|
| 46 |
virtual void HandleTranslationUnit(clang::ASTContext &Ctx); |
| 47 |
|
| 48 |
void doCombination(); |
| 49 |
|
| 50 |
llvm::DenseMap<const clang::Type *, clang::DeclStmt *> DeclStmts; |
| 51 |
|
| 52 |
llvm::SmallVector<clang::DeclStmt *, 2> TheDeclStmts; |
| 53 |
|
| 54 |
CombLocalVarCollectionVisitor *CollectionVisitor; |
| 55 |
|
| 56 |
|
| 57 |
CombineLocalVarDecl(void); |
| 58 |
|
| 59 |
CombineLocalVarDecl(const CombineLocalVarDecl &); |
| 60 |
|
| 61 |
void operator=(const CombineLocalVarDecl &); |
| 62 |
}; |
| 63 |
#endif |