summaryrefslogtreecommitdiffstats
path: root/clang/lib/Index/Entity.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-21 07:52:21 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-07-21 07:52:21 +0000
commit8274ad5281d02515a66087f93d2d7ec0c7b516e2 (patch)
treeb702610127f4024233adc724bedeac1b45727a6e /clang/lib/Index/Entity.cpp
parent25f9fc58511807f712d7789a09157da2986f52d1 (diff)
downloadbcm5719-llvm-8274ad5281d02515a66087f93d2d7ec0c7b516e2.tar.gz
bcm5719-llvm-8274ad5281d02515a66087f93d2d7ec0c7b516e2.zip
Remove the ASTContext parameter from Entity::getPrintableName().
llvm-svn: 76546
Diffstat (limited to 'clang/lib/Index/Entity.cpp')
-rw-r--r--clang/lib/Index/Entity.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/clang/lib/Index/Entity.cpp b/clang/lib/Index/Entity.cpp
index cc45e25cc76..c7924f65fc3 100644
--- a/clang/lib/Index/Entity.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud