| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef SIMPLIFY_RECURSIVE_TEMPLATE_INSTANTIATION_H |
| 12 |
#define SIMPLIFY_RECURSIVE_TEMPLATE_INSTANTIATION_H |
| 13 |
|
| 14 |
#include "llvm/ADT/SmallVector.h" |
| 15 |
#include "clang/AST/TypeLoc.h" |
| 16 |
#include "Transformation.h" |
| 17 |
|
| 18 |
namespace clang { |
| 19 |
class DeclGroupRef; |
| 20 |
class ASTContext; |
| 21 |
class TemplateDecl; |
| 22 |
} |
| 23 |
|
| 24 |
class SimplifyRecursiveTemplateInstantiationASTVisitor; |
| 25 |
|
| 26 |
class SimplifyRecursiveTemplateInstantiation : public Transformation { |
| 27 |
friend class SimplifyRecursiveTemplateInstantiationASTVisitor; |
| 28 |
|
| 29 |
public: |
| 30 |
SimplifyRecursiveTemplateInstantiation(const char *TransName, |
| 31 |
const char *Desc) |
| 32 |
: Transformation(TransName, Desc), |
| 33 |
CollectionVisitor(NULL), |
| 34 |
TheLocPair(NULL) |
| 35 |
{} |
| 36 |
|
| 37 |
~SimplifyRecursiveTemplateInstantiation(); |
| 38 |
|
| 39 |
void handleInnerTemplateSpecializationTypeLoc( |
| 40 |
const clang::TemplateSpecializationTypeLoc &ParentTLoc, |
| 41 |
const clang::TemplateSpecializationTypeLoc &TLoc); |
| 42 |
|
| 43 |
private: |
| 44 |
|
| 45 |
typedef llvm::SmallVector<clang::TemplateSpecializationTypeLoc, 2> |
| 46 |
SpecTypeLocPair; |
| 47 |
|
| 48 |
typedef llvm::SmallVector<SpecTypeLocPair *, 20> |
| 49 |
SpecTypeLocPairQueue; |
| 50 |
|
| 51 |
virtual void Initialize(clang::ASTContext &context); |
| 52 |
|
| 53 |
virtual void HandleTranslationUnit(clang::ASTContext &Ctx); |
| 54 |
|
| 55 |
void handleTemplateSpecializationTypeLoc( |
| 56 |
const clang::TemplateSpecializationTypeLoc &TLoc); |
| 57 |
|
| 58 |
const clang::TemplateDecl * |
| 59 |
getTemplateDeclFromSpecLoc(const clang::TemplateSpecializationTypeLoc &TLoc); |
| 60 |
|
| 61 |
void rewriteTemplateArgument(); |
| 62 |
|
| 63 |
void analyzeLocPairs(); |
| 64 |
|
| 65 |
SpecTypeLocPairQueue LocPairQueue; |
| 66 |
|
| 67 |
SimplifyRecursiveTemplateInstantiationASTVisitor *CollectionVisitor; |
| 68 |
|
| 69 |
SpecTypeLocPair *TheLocPair; |
| 70 |
|
| 71 |
|
| 72 |
SimplifyRecursiveTemplateInstantiation(); |
| 73 |
|
| 74 |
SimplifyRecursiveTemplateInstantiation( |
| 75 |
const SimplifyRecursiveTemplateInstantiation &); |
| 76 |
|
| 77 |
void operator=(const SimplifyRecursiveTemplateInstantiation &); |
| 78 |
}; |
| 79 |
|
| 80 |
#endif |