Debian Codegraph @

clang_delta/RemoveArray.h

raw symbols SCIP
1 //===----------------------------------------------------------------------===//
2 //
3 // Copyright (c) 2012, 2013, 2016 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 REMOVE_ARRAY_H
12 #define REMOVE_ARRAY_H
13
14 #include <utility>
15 #include "Transformation.h"
16 #include "llvm/ADT/MapVector.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 RemoveArrayCollectionVisitor;
27 class InvalidArraySubscriptExprVisitor;
28
29 class RemoveArray : public Transformation {
30 friend class RemoveArrayCollectionVisitor;
31 friend class InvalidArraySubscriptExprVisitor;
32
33 public:
34
35 RemoveArray(const char *TransName, const char *Desc)
36 : Transformation(TransName, Desc),
37 CollectionVisitor(NULL),
38 TheArrayVarDecl(NULL),
39 TheASEVec(NULL)
40 { }
41
42 ~RemoveArray(void);
43
44 private:
45
46 typedef llvm::SmallVector<clang::ArraySubscriptExpr *, 10>
47 ArraySubscriptExprVector;
48
49 typedef llvm::MapVector<const clang::VarDecl *, ArraySubscriptExprVector *>
50 VarDeclToArraySubscriptExprMap;
51
52 typedef std::pair<clang::SourceLocation, clang::SourceLocation>
53 BracketLocPair;
54
55 virtual void Initialize(clang::ASTContext &context);
56
57 virtual void HandleTranslationUnit(clang::ASTContext &Ctx);
58
59 void doAnalysis(void);
60
61 void doRewriting(void);
62
63 void addOneArraySubscriptExpr(clang::ArraySubscriptExpr *ASE,
64 const clang::DeclRefExpr *DRE);
65
66 void deleteOneVarDecl(const clang::DeclRefExpr *DRE);
67
68 void handleOneVarDecl(const clang::VarDecl *VD);
69
70 void getBracketLocPair(const clang::VarDecl *VD, BracketLocPair &LocPair);
71
72 const clang::VarDecl *getVarDeclFromArraySubscriptExpr(
73 const clang::ArraySubscriptExpr *ASE);
74
75 VarDeclToArraySubscriptExprMap ValidVarToASEMap;
76
77 RemoveArrayCollectionVisitor *CollectionVisitor;
78
79 const clang::VarDecl *TheArrayVarDecl;
80
81 ArraySubscriptExprVector *TheASEVec;
82
83 // Unimplemented
84 RemoveArray(void);
85
86 RemoveArray(const RemoveArray &);
87
88 void operator=(const RemoveArray &);
89 };
90
91 #endif