| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef REMOVE_POINTER_H |
| 12 |
#define REMOVE_POINTER_H |
| 13 |
|
| 14 |
#include <utility> |
| 15 |
#include "Transformation.h" |
| 16 |
#include "llvm/ADT/SetVector.h" |
| 17 |
#include "llvm/ADT/SmallPtrSet.h" |
| 18 |
|
| 19 |
namespace clang { |
| 20 |
class DeclGroupRef; |
| 21 |
class ASTContext; |
| 22 |
class VarDecl; |
| 23 |
class DeclRefExpr; |
| 24 |
} |
| 25 |
|
| 26 |
class RemovePointerCollectionVisitor; |
| 27 |
|
| 28 |
class RemovePointer : public Transformation { |
| 29 |
friend class RemovePointerCollectionVisitor; |
| 30 |
|
| 31 |
public: |
| 32 |
|
| 33 |
RemovePointer(const char *TransName, const char *Desc) |
| 34 |
: Transformation(TransName, Desc), |
| 35 |
CollectionVisitor(NULL), |
| 36 |
TheVarDecl(NULL) |
| 37 |
{ } |
| 38 |
|
| 39 |
~RemovePointer(void); |
| 40 |
|
| 41 |
private: |
| 42 |
|
| 43 |
typedef llvm::SmallPtrSet<const clang::VarDecl *, 10> VarDeclSet; |
| 44 |
typedef llvm::SetVector<const clang::VarDecl *> VarDeclSetVector; |
| 45 |
|
| 46 |
virtual void Initialize(clang::ASTContext &context); |
| 47 |
|
| 48 |
virtual void HandleTranslationUnit(clang::ASTContext &Ctx); |
| 49 |
|
| 50 |
void doAnalysis(void); |
| 51 |
|
| 52 |
void doRewriting(void); |
| 53 |
|
| 54 |
void handleOneVarDecl(const clang::VarDecl *VD); |
| 55 |
|
| 56 |
void invalidateOneVarDecl(const clang::DeclRefExpr *DRE); |
| 57 |
|
| 58 |
VarDeclSetVector AllPointerVarDecls; |
| 59 |
|
| 60 |
VarDeclSet AllInvalidPointerVarDecls; |
| 61 |
|
| 62 |
RemovePointerCollectionVisitor *CollectionVisitor; |
| 63 |
|
| 64 |
const clang::VarDecl *TheVarDecl; |
| 65 |
|
| 66 |
|
| 67 |
RemovePointer(void); |
| 68 |
|
| 69 |
RemovePointer(const RemovePointer &); |
| 70 |
|
| 71 |
void operator=(const RemovePointer &); |
| 72 |
}; |
| 73 |
|
| 74 |
#endif |