]> granicus.if.org Git - clang/commitdiff
Rename Entity::getName() to Entity::getPrintableName() to make its purpose
authorZhongxing Xu <xuzhongxing@gmail.com>
Fri, 17 Jul 2009 07:49:44 +0000 (07:49 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Fri, 17 Jul 2009 07:49:44 +0000 (07:49 +0000)
more obvious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76167 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/CallGraph.h
include/clang/Index/Entity.h
lib/Analysis/CallGraph.cpp
lib/Index/Entity.cpp

index 8de0e9f9764934622236545b0d5fe91db481b329..e64c2ca8c752b49cb59dd7b2d10e02ef09573b5b 100644 (file)
@@ -45,7 +45,7 @@ public:
 
   bool hasCallee() const { return begin() != end(); }
 
-  const char *getName(ASTContext &Ctx) { return F->getName(Ctx); }
+  std::string getName(ASTContext &Ctx) { return F->getPrintableName(Ctx); }
 };
 
 class CallGraph {
index e65412cbf5e8422b673369d0d97f9d891f383899..e1671bbdce6c9e122aac864dc9938784387de5dd 100644 (file)
@@ -43,8 +43,8 @@ public:
   /// \brief Find the Decl that can be referred to by this entity.
   Decl *getDecl(ASTContext &AST);
 
-  /// \brief Get the Decl's name.
-  const char *getName(ASTContext &Ctx);
+  /// \brief Get a printable name for debugging purpose.
+  std::string getPrintableName(ASTContext &Ctx);
 
   /// \brief Get an Entity associated with the given Decl.
   /// \returns Null if an Entity cannot refer to this Decl.
index 2ec6d2014d8e309d4e795c1ea24c3ff9ee274b91..b4f57b8fde47be17c9a7302ac5f941d9296f7226 100644 (file)
@@ -118,10 +118,11 @@ void CallGraph::print(llvm::raw_ostream &os) {
   for (iterator I = begin(), E = end(); I != E; ++I) {
     if (I->second->hasCallee()) {
       ASTContext &Ctx = *CallerCtx[I->second];
-      os << "function: " << I->first->getName(Ctx) << " calls:\n";
+      os << "function: " << I->first->getPrintableName(Ctx).c_str() 
+         << " calls:\n";
       for (CallGraphNode::iterator CI = I->second->begin(), 
              CE = I->second->end(); CI != CE; ++CI) {
-        os << "    " << CI->second->getName(Ctx);
+        os << "    " << CI->second->getName(Ctx).c_str();
       }
       os << '\n';
     }
index ca2e7c8f3e6b85041706196ffa7f75ca68551d06..7a6c05c416a4e45af92f7785c603f190f2b1f1b2 100644 (file)
@@ -126,11 +126,11 @@ Decl *Entity::getDecl(ASTContext &AST) {
   return 0; // Failed to find a decl using this Entity.
 }
 
-const char *Entity::getName(ASTContext &Ctx) {
+std::string Entity::getPrintableName(ASTContext &Ctx) {
   if (const NamedDecl *ND = dyn_cast_or_null<NamedDecl>(getDecl(Ctx))) {
-    return ND->getNameAsCString();
+    return ND->getNameAsString();
   }
-  return 0;
+  return std::string();
 }
 
 /// \brief Get an Entity associated with the given Decl.