| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef REPLACE_ONE_LEVEL_TYPEDEF_TYPE_H |
| 12 |
#define REPLACE_ONE_LEVEL_TYPEDEF_TYPE_H |
| 13 |
|
| 14 |
#include "Transformation.h" |
| 15 |
#include "llvm/ADT/MapVector.h" |
| 16 |
#include "llvm/ADT/SmallVector.h" |
| 17 |
#include "clang/AST/TypeLoc.h" |
| 18 |
|
| 19 |
namespace clang { |
| 20 |
class DeclGroupRef; |
| 21 |
class ASTContext; |
| 22 |
class TypedefDecl; |
| 23 |
} |
| 24 |
|
| 25 |
class ReplaceOneLevelTypedefTypeCollectionVisitor; |
| 26 |
|
| 27 |
class ReplaceOneLevelTypedefType : public Transformation { |
| 28 |
friend class ReplaceOneLevelTypedefTypeCollectionVisitor; |
| 29 |
|
| 30 |
public: |
| 31 |
ReplaceOneLevelTypedefType(const char *TransName, const char *Desc) |
| 32 |
: Transformation(TransName, Desc), |
| 33 |
CollectionVisitor(NULL) |
| 34 |
{} |
| 35 |
|
| 36 |
~ReplaceOneLevelTypedefType(void); |
| 37 |
|
| 38 |
private: |
| 39 |
|
| 40 |
typedef llvm::SmallVector<clang::TypedefTypeLoc, 10> |
| 41 |
TypedefTypeLocVector; |
| 42 |
|
| 43 |
typedef llvm::MapVector<const clang::TypedefDecl *, |
| 44 |
TypedefTypeLocVector *> |
| 45 |
TypedefDeclToRefMap; |
| 46 |
|
| 47 |
virtual void Initialize(clang::ASTContext &context); |
| 48 |
|
| 49 |
virtual void HandleTranslationUnit(clang::ASTContext &Ctx); |
| 50 |
|
| 51 |
void handleOneTypedefTypeLoc(clang::TypedefTypeLoc TLoc); |
| 52 |
|
| 53 |
void analyzeTypeLocs(); |
| 54 |
|
| 55 |
void rewriteTypedefType(); |
| 56 |
|
| 57 |
void removeTypedefs(); |
| 58 |
|
| 59 |
TypedefDeclToRefMap AllTypeDecls; |
| 60 |
|
| 61 |
clang::TypedefTypeLoc TheTypeLoc; |
| 62 |
|
| 63 |
ReplaceOneLevelTypedefTypeCollectionVisitor *CollectionVisitor; |
| 64 |
|
| 65 |
const clang::TypedefDecl *TheTypedefDecl; |
| 66 |
|
| 67 |
|
| 68 |
ReplaceOneLevelTypedefType(void); |
| 69 |
|
| 70 |
ReplaceOneLevelTypedefType(const ReplaceOneLevelTypedefType &); |
| 71 |
|
| 72 |
void operator=(const ReplaceOneLevelTypedefType &); |
| 73 |
}; |
| 74 |
|
| 75 |
#endif |
| 76 |
|