[cfe-commits] r76167 - in /cfe/trunk: include/clang/Analysis/CallGraph.h include/clang/Index/Entity.h lib/Analysis/CallGraph.cpp lib/Index/Entity.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Fri Jul 17 00:50:25 PDT 2009
Author: zhongxingxu
Date: Fri Jul 17 02:49:44 2009
New Revision: 76167
URL: http://llvm.org/viewvc/llvm-project?rev=76167&view=rev
Log:
Rename Entity::getName() to Entity::getPrintableName() to make its purpose
more obvious.
Modified:
cfe/trunk/include/clang/Analysis/CallGraph.h
cfe/trunk/include/clang/Index/Entity.h
cfe/trunk/lib/Analysis/CallGraph.cpp
cfe/trunk/lib/Index/Entity.cpp
Modified: cfe/trunk/include/clang/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CallGraph.h?rev=76167&r1=76166&r2=76167&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/CallGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/CallGraph.h Fri Jul 17 02:49:44 2009
@@ -45,7 +45,7 @@
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 {
Modified: cfe/trunk/include/clang/Index/Entity.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Index/Entity.h?rev=76167&r1=76166&r2=76167&view=diff
==============================================================================
--- cfe/trunk/include/clang/Index/Entity.h (original)
+++ cfe/trunk/include/clang/Index/Entity.h Fri Jul 17 02:49:44 2009
@@ -43,8 +43,8 @@
/// \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.
Modified: cfe/trunk/lib/Analysis/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CallGraph.cpp?rev=76167&r1=76166&r2=76167&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CallGraph.cpp (original)
+++ cfe/trunk/lib/Analysis/CallGraph.cpp Fri Jul 17 02:49:44 2009
@@ -118,10 +118,11 @@
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';
}
Modified: cfe/trunk/lib/Index/Entity.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/Entity.cpp?rev=76167&r1=76166&r2=76167&view=diff
==============================================================================
--- cfe/trunk/lib/Index/Entity.cpp (original)
+++ cfe/trunk/lib/Index/Entity.cpp Fri Jul 17 02:49:44 2009
@@ -126,11 +126,11 @@
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.
More information about the cfe-commits
mailing list