summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-07-17 07:49:44 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-07-17 07:49:44 +0000
commit9d05213899403117dc6e9a6223c71d3ea666bb41 (patch)
treee177483f5e7ae66c6fb482d61cdc2ca27da5a419
parent3436f58e40bb92a4dae81355798f1273b2159e2a (diff)
downloadbcm5719-llvm-9d05213899403117dc6e9a6223c71d3ea666bb41.tar.gz
bcm5719-llvm-9d05213899403117dc6e9a6223c71d3ea666bb41.zip
Rename Entity::getName() to Entity::getPrintableName() to make its purpose
more obvious. llvm-svn: 76167
-rw-r--r--clang/include/clang/Analysis/CallGraph.h2
-rw-r--r--clang/include/clang/Index/Entity.h4
-rw-r--r--clang/lib/Analysis/CallGraph.cpp5
-rw-r--r--clang/lib/Index/Entity.cpp6
4 files changed, 9 insertions, 8 deletions
diff --git a/clang/include/clang/Analysis/CallGraph.h b/clang/include/clang/Analysis/CallGraph.h
index 8de0e9f9764..e64c2ca8c75 100644
--- a/clang/include/clang/Analysis/CallGraph.h
+++ b/clang/include/clang/Analysis/CallGraph.h
@@ -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 {
diff --git a/clang/include/clang/Index/Entity.h b/clang/include/clang/Index/Entity.h
index e65412cbf5e..e1671bbdce6 100644
--- a/clang/include/clang/Index/Entity.h
+++ b/clang/include/clang/Index/Entity.h
@@ -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.
diff --git a/clang/lib/Analysis/CallGraph.cpp b/clang/lib/Analysis/CallGraph.cpp
index 2ec6d2014d8..b4f57b8fde4 100644
--- a/clang/lib/Analysis/CallGraph.cpp
+++ b/clang/lib/Analysis/CallGraph.cpp
@@ -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';
}
diff --git a/clang/lib/Index/Entity.cpp b/clang/lib/Index/Entity.cpp
index ca2e7c8f3e6..7a6c05c416a 100644
--- a/clang/lib/Index/Entity.cpp
+++ b/clang/lib/Index/Entity.cpp
@@ -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.
OpenPOWER on IntegriCloud