diff options
-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)) |