]> granicus.if.org Git - clang/commitdiff
[AST] Change NamedDecl::getUnderlyingDecl() to inline the fast (and incredibly common...
authorDaniel Dunbar <daniel@zuster.org>
Thu, 8 Mar 2012 18:20:41 +0000 (18:20 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 8 Mar 2012 18:20:41 +0000 (18:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152321 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h
lib/AST/Decl.cpp

index 1a8d353f4511f2a650d59df8259f085a77431d38..7c042c181612e11bf0cf21d4c48cf1e0615d9e6a 100644 (file)
@@ -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();
   }
index 63f1f16ea65c26e8f7f2a8ccc05cfe4a49e4058b..f2ac5c14a15759a5ddb0f79defab07be0852587b 100644 (file)
@@ -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))