Debian Codegraph @

clang_delta/ReplaceSimpleTypedef.h

raw symbols SCIP
1 //===----------------------------------------------------------------------===//
2 //
3 // Copyright (c) 2012, 2013 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 REPLACE_SIMPLE_TYPEDEF_H
12 #define REPLACE_SIMPLE_TYPEDEF_H
13
14 #include "Transformation.h"
15 #include "llvm/ADT/SmallPtrSet.h"
16
17 namespace clang {
18 class DeclGroupRef;
19 class ASTContext;
20 class TypedefDecl;
21 }
22
23 class ReplaceSimpleTypedefCollectionVisitor;
24 class ReplaceSimpleTypedefRewriteVisitor;
25
26 class ReplaceSimpleTypedef : public Transformation {
27 friend class ReplaceSimpleTypedefCollectionVisitor;
28 friend class ReplaceSimpleTypedefRewriteVisitor;
29
30 public:
31 ReplaceSimpleTypedef(const char *TransName, const char *Desc)
32 : Transformation(TransName, Desc),
33 CollectionVisitor(NULL),
34 RewriteVisitor(NULL),
35 TyName(""),
36 IsScalarType(false)
37 {}
38
39 ~ReplaceSimpleTypedef();
40
41 private:
42
43 typedef llvm::SmallPtrSet<const clang::TypedefDecl *, 20> TypedefDeclsSet;
44
45 virtual void Initialize(clang::ASTContext &context);
46
47 virtual void HandleTranslationUnit(clang::ASTContext &Ctx);
48
49 void handleOneTypedefDecl(const clang::TypedefDecl *CanonicalD);
50
51 bool isValidType(const clang::Type *Ty, const clang::TypedefDecl *D);
52
53 void removeTypedefs();
54
55 TypedefDeclsSet VisitedTypedefDecls;
56
57 ReplaceSimpleTypedefCollectionVisitor *CollectionVisitor;
58
59 ReplaceSimpleTypedefRewriteVisitor *RewriteVisitor;
60
61 const clang::TypedefDecl *TheTypedefDecl;
62
63 std::string TyName;
64
65 bool IsScalarType;
66
67 // Unimplemented
68 ReplaceSimpleTypedef();
69
70 ReplaceSimpleTypedef(const ReplaceSimpleTypedef &);
71
72 void operator=(const ReplaceSimpleTypedef &);
73 };
74
75 #endif
76