Debian Codegraph @

clang_delta/ReplaceDerivedClass.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 REPLACE_DERIVED_CLASS_H
12 #define REPLACE_DERIVED_CLASS_H
13
14 #include "llvm/ADT/SmallPtrSet.h"
15 #include "Transformation.h"
16
17 namespace clang {
18 class DeclGroupRef;
19 class ASTContext;
20 class CXXRecordDecl;
21 }
22
23 class ReplaceDerivedClassASTVisitor;
24 class ReplaceDerivedClassRewriteVisitor;
25
26 class ReplaceDerivedClass : public Transformation {
27 friend class ReplaceDerivedClassASTVisitor;
28 friend class ReplaceDerivedClassRewriteVisitor;
29
30 public:
31
32 ReplaceDerivedClass(const char *TransName, const char *Desc)
33 : Transformation(TransName, Desc),
34 CollectionVisitor(NULL),
35 RewriteVisitor(NULL),
36 TheDerivedClass(NULL),
37 TheBaseClass(NULL)
38 { }
39
40 ~ReplaceDerivedClass(void);
41
42 private:
43
44 typedef llvm::SmallPtrSet<const clang::CXXRecordDecl *, 10> CXXRecordDeclSet;
45
46 virtual void Initialize(clang::ASTContext &context);
47
48 virtual void HandleTranslationUnit(clang::ASTContext &Ctx);
49
50 bool isValidBaseDerivedPair(const clang::CXXRecordDecl *Base,
51 const clang::CXXRecordDecl *Derived);
52
53 bool isEmptyClass(const clang::CXXRecordDecl *CXXDef);
54
55 void handleOneCXXRecordDecl(const clang::CXXRecordDecl *CXXRD);
56
57 void doRewrite(void);
58
59 CXXRecordDeclSet VisitedCXXRecordDecls;
60
61 ReplaceDerivedClassASTVisitor *CollectionVisitor;
62
63 ReplaceDerivedClassRewriteVisitor *RewriteVisitor;
64
65 const clang::CXXRecordDecl *TheDerivedClass;
66
67 const clang::CXXRecordDecl *TheBaseClass;
68
69 // Unimplemented
70 ReplaceDerivedClass(void);
71
72 ReplaceDerivedClass(const ReplaceDerivedClass &);
73
74 void operator=(const ReplaceDerivedClass &);
75 };
76
77 #endif
78