void VisitObjCMethodDecl(ObjCMethodDecl *MD);
void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
void VisitRecordDecl(RecordDecl *D);
+ void VisitTagDeclCommon(TagDecl *D);
void VisitTypedefDecl(TypedefDecl *D);
};
} // end anonymous namespace
void USRGenerator::VisitEnumDecl(EnumDecl *D) {
VisitDeclContext(D->getDeclContext());
Out << "@E^";
- const std::string &s = D->getNameAsString();
- if (s.empty())
- Out << "anon";
- else
- Out << s;
+ VisitTagDeclCommon(D);
}
void USRGenerator::VisitFunctionDecl(FunctionDecl *D) {
void USRGenerator::VisitRecordDecl(RecordDecl *D) {
VisitDeclContext(D->getDeclContext());
Out << "@S^";
- // FIXME: Better support for anonymous structures.
- const std::string &s = D->getNameAsString();
- if (s.empty()) {
- if (TypedefDecl *TD = D->getTypedefForAnonDecl())
- Out << "^anontd^" << TD->getNameAsString();
- else
- Out << "^anon";
- }
- else
- Out << s;
+ VisitTagDeclCommon(D);
}
void USRGenerator::VisitObjCMethodDecl(ObjCMethodDecl *D) {
Out << "(py)" << D->getName();
}
+void USRGenerator::VisitTagDeclCommon(TagDecl *D) {
+ // FIXME: Better support for anonymous structures and enums.
+ const std::string &s = D->getNameAsString();
+ if (s.empty()) {
+ if (TypedefDecl *TD = D->getTypedefForAnonDecl())
+ Out << "^anontd^" << TD->getNameAsString();
+ else
+ Out << "^anon";
+ }
+ else
+ Out << s;
+}
+
void USRGenerator::VisitTypedefDecl(TypedefDecl *D) {
DeclContext *DC = D->getDeclContext();
if (NamedDecl *DCN = dyn_cast<NamedDecl>(DC))