diff options
author | Daniel Dunbar <daniel@zuster.org> | 2012-03-08 18:20:41 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2012-03-08 18:20:41 +0000 |
commit | 6daffa5d6031eee8b25fc2c745dd6b58b039a6eb (patch) | |
tree | 19fbebe21e978cdf7b64bfcce4f1887593d07058 | |
parent | 025039377d7247620750205dbd61ca1ba336f7e0 (diff) |
[AST] Change NamedDecl::getUnderlyingDecl() to inline the fast (and incredibly common) path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152321 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Decl.h | 8 | ||||
-rw-r--r-- | lib/AST/Decl.cpp | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 1a8d353f45..7c042c1816 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -323,7 +323,13 @@ public: /// \brief Looks through UsingDecls and ObjCCompatibleAliasDecls for /// the underlying named decl. - NamedDecl *getUnderlyingDecl(); + NamedDecl *getUnderlyingDecl() { + if (!(this->getKind() == UsingShadow) && + !(this->getKind() == ObjCCompatibleAlias)) + return this; + return getUnderlyingDeclImpl(); + } + NamedDecl *getUnderlyingDeclImpl(); const NamedDecl *getUnderlyingDecl() const { return const_cast<NamedDecl*>(this)->getUnderlyingDecl(); } diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 63f1f16ea6..f2ac5c14a1 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -983,7 +983,7 @@ bool NamedDecl::hasLinkage() const { return getLinkage() != NoLinkage; } -NamedDecl *NamedDecl::getUnderlyingDecl() { +NamedDecl *NamedDecl::getUnderlyingDeclImpl() { NamedDecl *ND = this; while (true) { if (UsingShadowDecl *UD = dyn_cast<UsingShadowDecl>(ND)) |