Remove the ASTContext parameter from Entity::getPrintableName().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76546 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Index/Entity.cpp b/lib/Index/Entity.cpp
index cc45e25..c7924f6 100644
--- a/lib/Index/Entity.cpp
+++ b/lib/Index/Entity.cpp
@@ -134,6 +134,10 @@
   return EntityGetter(Prog).Visit(D);
 }
 
+std::string EntityImpl::getPrintableName() {
+  return std::string(Id->getKeyData(), Id->getKeyData() + Id->getKeyLength());
+}
+
 //===----------------------------------------------------------------------===//
 // Entity Implementation
 //===----------------------------------------------------------------------===//
@@ -152,11 +156,18 @@
   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.