diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-21 07:52:21 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-07-21 07:52:21 +0000 |
commit | 4c7c5a1d01d5e35aa6fb7724336c9506a88b6b62 (patch) | |
tree | bd4f2e7866dcae901b5a3dc6d017c5a16d8118a9 /lib/Index/Entity.cpp | |
parent | 2bcb3439b50c7f227a21d7118a2a76904ec60331 (diff) |
Remove the ASTContext parameter from Entity::getPrintableName().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76546 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Index/Entity.cpp')
-rw-r--r-- | lib/Index/Entity.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/Index/Entity.cpp b/lib/Index/Entity.cpp index cc45e25cc7..c7924f65fc 100644 --- a/lib/Index/Entity.cpp +++ b/lib/Index/Entity.cpp @@ -134,6 +134,10 @@ Entity EntityImpl::get(Decl *D, ProgramImpl &Prog) { return EntityGetter(Prog).Visit(D); } +std::string EntityImpl::getPrintableName() { + return std::string(Id->getKeyData(), Id->getKeyData() + Id->getKeyLength()); +} + //===----------------------------------------------------------------------===// // Entity Implementation //===----------------------------------------------------------------------===// @@ -152,11 +156,18 @@ Decl *Entity::getDecl(ASTContext &AST) { return Val.get<EntityImpl *>()->getDecl(AST); } -std::string Entity::getPrintableName(ASTContext &Ctx) { - if (const NamedDecl *ND = dyn_cast_or_null<NamedDecl>(getDecl(Ctx))) { - return ND->getNameAsString(); +std::string Entity::getPrintableName() { + if (isInvalid()) + return "<< Invalid >>"; + + if (Decl *D = Val.dyn_cast<Decl *>()) { + if (NamedDecl *ND = dyn_cast<NamedDecl>(D)) + return ND->getNameAsString(); + else + return std::string(); } - return std::string(); + + return Val.get<EntityImpl *>()->getPrintableName(); } /// \brief Get an Entity associated with the given Decl. |