| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef INSTANTIATE_TEMPLATE_TYPE_PARAM_TO_INT_H |
| 12 |
#define INSTANTIATE_TEMPLATE_TYPE_PARAM_TO_INT_H |
| 13 |
|
| 14 |
#include "llvm/ADT/SmallPtrSet.h" |
| 15 |
#include "Transformation.h" |
| 16 |
|
| 17 |
namespace clang { |
| 18 |
class DeclGroupRef; |
| 19 |
class ASTContext; |
| 20 |
class TemplateDecl; |
| 21 |
class NamedDecl; |
| 22 |
} |
| 23 |
|
| 24 |
class InstantiateTemplateTypeParamToIntASTVisitor; |
| 25 |
class InstantiateTemplateTypeParamToIntRewriteVisitor; |
| 26 |
|
| 27 |
class InstantiateTemplateTypeParamToInt : public Transformation { |
| 28 |
friend class InstantiateTemplateTypeParamToIntASTVisitor; |
| 29 |
friend class InstantiateTemplateTypeParamToIntRewriteVisitor; |
| 30 |
friend class TemplateParameterFilterVisitor; |
| 31 |
|
| 32 |
public: |
| 33 |
InstantiateTemplateTypeParamToInt(const char *TransName, const char *Desc) |
| 34 |
: Transformation(TransName, Desc), |
| 35 |
CollectionVisitor(NULL), |
| 36 |
ParamRewriteVisitor(NULL), |
| 37 |
TheParameter(NULL) |
| 38 |
{} |
| 39 |
|
| 40 |
~InstantiateTemplateTypeParamToInt(); |
| 41 |
|
| 42 |
private: |
| 43 |
|
| 44 |
typedef llvm::SmallPtrSet<const clang::TemplateDecl *, 10> TemplateDeclSet; |
| 45 |
|
| 46 |
typedef llvm::SmallPtrSet<const clang::NamedDecl *, 8> TemplateParameterSet; |
| 47 |
|
| 48 |
typedef llvm::SmallPtrSet<void *, 10> LocPtrSet; |
| 49 |
|
| 50 |
virtual void Initialize(clang::ASTContext &context); |
| 51 |
|
| 52 |
virtual void HandleTranslationUnit(clang::ASTContext &Ctx); |
| 53 |
|
| 54 |
void handleOneTemplateDecl(const clang::TemplateDecl *D); |
| 55 |
|
| 56 |
void filterInvalidParams(const clang::TemplateDecl *D, |
| 57 |
TemplateParameterSet &Params); |
| 58 |
|
| 59 |
TemplateDeclSet VisitedTemplateDecls; |
| 60 |
|
| 61 |
LocPtrSet VisitedLocs; |
| 62 |
|
| 63 |
InstantiateTemplateTypeParamToIntASTVisitor *CollectionVisitor; |
| 64 |
|
| 65 |
InstantiateTemplateTypeParamToIntRewriteVisitor *ParamRewriteVisitor; |
| 66 |
|
| 67 |
const clang::NamedDecl *TheParameter; |
| 68 |
|
| 69 |
|
| 70 |
InstantiateTemplateTypeParamToInt(); |
| 71 |
|
| 72 |
InstantiateTemplateTypeParamToInt(const InstantiateTemplateTypeParamToInt &); |
| 73 |
|
| 74 |
void operator=(const InstantiateTemplateTypeParamToInt &); |
| 75 |
}; |
| 76 |
|
| 77 |
#endif |