Debian Codegraph @

clang_delta/ReducePointerPairs.h

raw symbols SCIP
1 //===----------------------------------------------------------------------===//
2 //
3 // Copyright (c) 2012 The University of Utah
4 // All rights reserved.
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See the file COPYING for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #ifndef REDUCE_POINTER_PAIRS_H
12 #define REDUCE_POINTER_PAIRS_H
13
14 #include "Transformation.h"
15 #include "llvm/ADT/DenseMap.h"
16
17 namespace clang {
18 class DeclGroupRef;
19 class ASTContext;
20 class VarDecl;
21 }
22
23 class ReducePointerPairsCollectionVisitor;
24 class ReducePointerPairsInvalidatingVisitor;
25
26 class ReducePointerPairs : public Transformation {
27 friend class ReducePointerPairsCollectionVisitor;
28 friend class ReducePointerPairsInvalidatingVisitor;
29
30 public:
31
32 ReducePointerPairs(const char *TransName, const char *Desc)
33 : Transformation(TransName, Desc),
34 CollectionVisitor(NULL),
35 InvalidatingVisitor(NULL),
36 TheVarDecl(NULL),
37 ThePairedVarDecl(NULL)
38 { }
39
40 ~ReducePointerPairs(void);
41
42 private:
43
44 typedef llvm::DenseMap<const clang::VarDecl *, const clang::VarDecl *>
45 PointerMap;
46
47 virtual void Initialize(clang::ASTContext &context);
48
49 virtual void HandleTranslationUnit(clang::ASTContext &Ctx);
50
51 void handleOnePair(const clang::VarDecl *VD, const clang::Expr *E);
52
53 bool isValidVD(const clang::VarDecl *VD);
54
55 bool invalidatePairedVarDecl(const clang::VarDecl *VD);
56
57 const clang::VarDecl *getVarDeclFromDRE(const clang::Expr *E);
58
59 bool isMappedVarDecl(const clang::VarDecl *VD);
60
61 void doRewriting(const clang::VarDecl *VD);
62
63 void doAnalysis(void);
64
65 void invalidateVarDecl(const clang::VarDecl *VD);
66
67 PointerMap ValidPointerPairs;
68
69 ReducePointerPairsCollectionVisitor *CollectionVisitor;
70
71 ReducePointerPairsInvalidatingVisitor *InvalidatingVisitor;
72
73 const clang::VarDecl *TheVarDecl;
74
75 const clang::VarDecl *ThePairedVarDecl;
76
77 // Unimplemented
78 ReducePointerPairs(void);
79
80 ReducePointerPairs(const ReducePointerPairs &);
81
82 void operator=(const ReducePointerPairs &);
83 };
84
85 #endif