From: Benjamin Kramer Date: Thu, 8 Mar 2012 21:00:45 +0000 (+0000) Subject: Untangle getUnderlyingDeclImpl, no functionality change. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=56757e9eaff77fb106662fa88793af866a6267d0;p=clang Untangle getUnderlyingDeclImpl, no functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152339 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index f2ac5c14a1..2f42607eab 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -985,15 +985,13 @@ bool NamedDecl::hasLinkage() const { NamedDecl *NamedDecl::getUnderlyingDeclImpl() { NamedDecl *ND = this; - while (true) { - if (UsingShadowDecl *UD = dyn_cast(ND)) - ND = UD->getTargetDecl(); - else if (ObjCCompatibleAliasDecl *AD - = dyn_cast(ND)) - return AD->getClassInterface(); - else - return ND; - } + while (UsingShadowDecl *UD = dyn_cast(ND)) + ND = UD->getTargetDecl(); + + if (ObjCCompatibleAliasDecl *AD = dyn_cast(ND)) + return AD->getClassInterface(); + + return ND; } bool NamedDecl::isCXXInstanceMember() const {