Add getName() method to Entity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75740 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Index/Entity.cpp b/lib/Index/Entity.cpp
index 2620f88..520d189 100644
--- a/lib/Index/Entity.cpp
+++ b/lib/Index/Entity.cpp
@@ -123,6 +123,13 @@
   return 0; // Failed to find a decl using this Entity.
 }
 
+const char *Entity::getName(ASTContext &Ctx) {
+  if (const NamedDecl *ND = dyn_cast_or_null<NamedDecl>(getDecl(Ctx))) {
+    return ND->getNameAsCString();
+  }
+  return 0;
+}
+
 /// \brief Get an Entity associated with the given Decl.
 /// \returns Null if an Entity cannot refer to this Decl.
 Entity *Entity::get(Decl *D, Program &Prog) {