| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef SIMPLIFY_DEPENDENT_TYPEDEF_H |
| 12 |
#define SIMPLIFY_DEPENDENT_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 |
class ClassTemplateDecl; |
| 22 |
class TemplateTypeParmDecl; |
| 23 |
} |
| 24 |
|
| 25 |
class DependentTypedefCollectionVisitor; |
| 26 |
class DependentTypedefTemplateTypeParmTypeVisitor; |
| 27 |
|
| 28 |
class SimplifyDependentTypedef : public Transformation { |
| 29 |
friend class DependentTypedefCollectionVisitor; |
| 30 |
friend class DependentTypedefTemplateTypeParmTypeVisitor; |
| 31 |
|
| 32 |
public: |
| 33 |
SimplifyDependentTypedef(const char *TransName, const char *Desc) |
| 34 |
: Transformation(TransName, Desc), |
| 35 |
CollectionVisitor(NULL), |
| 36 |
TemplateTypeParmTypeVisitor(NULL), |
| 37 |
FirstTmplTypeParmD(NULL) |
| 38 |
{} |
| 39 |
|
| 40 |
~SimplifyDependentTypedef(void); |
| 41 |
|
| 42 |
private: |
| 43 |
|
| 44 |
typedef llvm::SmallPtrSet<const clang::TypedefDecl *, 20> TypedefDeclsSet; |
| 45 |
|
| 46 |
typedef llvm::SmallPtrSet<const clang::Type *, 5> TemplateTypeParmTypeSet; |
| 47 |
|
| 48 |
virtual void Initialize(clang::ASTContext &context); |
| 49 |
|
| 50 |
virtual void HandleTranslationUnit(clang::ASTContext &Ctx); |
| 51 |
|
| 52 |
void handleOneTypedefDecl(const clang::TypedefDecl *D); |
| 53 |
|
| 54 |
void rewriteTypedefDecl(void); |
| 55 |
|
| 56 |
TypedefDeclsSet VisitedTypedefDecls; |
| 57 |
|
| 58 |
DependentTypedefCollectionVisitor *CollectionVisitor; |
| 59 |
|
| 60 |
DependentTypedefTemplateTypeParmTypeVisitor *TemplateTypeParmTypeVisitor; |
| 61 |
|
| 62 |
const clang::TemplateTypeParmDecl *FirstTmplTypeParmD; |
| 63 |
|
| 64 |
const clang::TypedefDecl *TheTypedefDecl; |
| 65 |
|
| 66 |
|
| 67 |
SimplifyDependentTypedef(void); |
| 68 |
|
| 69 |
SimplifyDependentTypedef(const SimplifyDependentTypedef &); |
| 70 |
|
| 71 |
void operator=(const SimplifyDependentTypedef &); |
| 72 |
}; |
| 73 |
|
| 74 |
#endif |