diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-07-15 04:39:21 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-07-15 04:39:21 +0000 |
commit | 12b1d137c249c511c2e966447ddfea26ba4fa5ef (patch) | |
tree | 525e4b03a809bf2be1ce2cb72cb92e9bba3998fe /clang/lib/Index/Entity.cpp | |
parent | 078a71e4a92970a66b96959d35b6479032e220cc (diff) | |
download | bcm5719-llvm-12b1d137c249c511c2e966447ddfea26ba4fa5ef.tar.gz bcm5719-llvm-12b1d137c249c511c2e966447ddfea26ba4fa5ef.zip |
Add getName() method to Entity.
llvm-svn: 75740
Diffstat (limited to 'clang/lib/Index/Entity.cpp')
-rw-r--r-- | clang/lib/Index/Entity.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Index/Entity.cpp b/clang/lib/Index/Entity.cpp index 2620f88a958..520d189826a 100644 --- a/clang/lib/Index/Entity.cpp +++ b/clang/lib/Index/Entity.cpp @@ -123,6 +123,13 @@ Decl *Entity::getDecl(ASTContext &AST) { 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) { |