Permalink
Browse files

put local visitors into an anonymous namespace

  • Loading branch information...
1 parent 6f776c5 commit 729c473e83342e108dbfb1e22ac44aa1dc0056c2 @chenyang78 chenyang78 committed May 10, 2012
Showing with 23 additions and 19 deletions.
  1. +23 −19 clang_delta/ReduceClassTemplateParameter.cpp
View
42 clang_delta/ReduceClassTemplateParameter.cpp
@@ -45,6 +45,8 @@ class ReduceClassTemplateParameterASTVisitor : public
};
+namespace {
+
class TemplateParameterVisitor : public
RecursiveASTVisitor<TemplateParameterVisitor> {
@@ -71,6 +73,14 @@ class TemplateParameterVisitor : public
TemplateParameterSet *UsedParameters;
};
+bool TemplateParameterVisitor::VisitTemplateTypeParmType(
+ TemplateTypeParmType *Ty)
+{
+ const TemplateTypeParmDecl *D = Ty->getDecl();
+ UsedParameters->insert(D);
+ return true;
+}
+
class ArgumentDependencyVisitor : public
RecursiveASTVisitor<ArgumentDependencyVisitor> {
@@ -88,6 +98,19 @@ class ArgumentDependencyVisitor : public
TypeToVisitsCountSet &VisitsCountSet;
};
+bool ArgumentDependencyVisitor::VisitTemplateTypeParmType(
+ TemplateTypeParmType *Ty)
+{
+ TypeToVisitsCountSet::iterator I = VisitsCountSet.find(Ty);
+ if (I != VisitsCountSet.end()) {
+ unsigned Count = (*I).second + 1;
+ VisitsCountSet[(*I).first] = Count;
+ }
+ return true;
+}
+
+}
+
class ReduceClassTemplateParameterRewriteVisitor : public
RecursiveASTVisitor<ReduceClassTemplateParameterRewriteVisitor> {
@@ -104,25 +127,6 @@ class ReduceClassTemplateParameterRewriteVisitor : public
ReduceClassTemplateParameter *ConsumerInstance;
};
-bool TemplateParameterVisitor::VisitTemplateTypeParmType(
- TemplateTypeParmType *Ty)
-{
- const TemplateTypeParmDecl *D = Ty->getDecl();
- UsedParameters->insert(D);
- return true;
-}
-
-bool ArgumentDependencyVisitor::VisitTemplateTypeParmType(
- TemplateTypeParmType *Ty)
-{
- TypeToVisitsCountSet::iterator I = VisitsCountSet.find(Ty);
- if (I != VisitsCountSet.end()) {
- unsigned Count = (*I).second + 1;
- VisitsCountSet[(*I).first] = Count;
- }
- return true;
-}
-
bool ReduceClassTemplateParameterRewriteVisitor::
VisitTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc Loc)
{

0 comments on commit 729c473

Please sign in to comment.