From 8433d1da5e1958de8de55a0623a10399608d01d9 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 15 Jan 2010 20:04:31 +0000 Subject: [PATCH] Add USR generation for enums. llvm-svn: 93543 --- clang/tools/CIndex/CIndexUSRs.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/clang/tools/CIndex/CIndexUSRs.cpp b/clang/tools/CIndex/CIndexUSRs.cpp index 549c65058d86..f9e1c23f7ae1 100644 --- a/clang/tools/CIndex/CIndexUSRs.cpp +++ b/clang/tools/CIndex/CIndexUSRs.cpp @@ -74,6 +74,7 @@ public: void VisitBlockDecl(BlockDecl *D); void VisitDeclContext(DeclContext *D); + void VisitEnumDecl(EnumDecl *D); void VisitFunctionDecl(FunctionDecl *D); void VisitNamedDecl(NamedDecl *D); void VisitNamespaceDecl(NamespaceDecl *D); @@ -96,6 +97,16 @@ void USRGenerator::VisitDeclContext(DeclContext *DC) { Visit(D); } +void USRGenerator::VisitEnumDecl(EnumDecl *D) { + VisitDeclContext(D->getDeclContext()); + Out << "@E^"; + const std::string &s = D->getNameAsString(); + if (s.empty()) + Out << "anon"; + else + Out << s; +} + void USRGenerator::VisitFunctionDecl(FunctionDecl *D) { VisitDeclContext(D->getDeclContext()); Out << "@F^" << D->getNameAsString();