]> granicus.if.org Git - clang/commitdiff
[AST] Clean up NamedDecl::getUnderlyingDecl() change a bit.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 8 Mar 2012 20:29:02 +0000 (20:29 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 8 Mar 2012 20:29:02 +0000 (20:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152332 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h

index 7c042c181612e11bf0cf21d4c48cf1e0615d9e6a..27a9d75f9212722d62cd7793bd36fd0ad882b4d2 100644 (file)
@@ -106,6 +106,9 @@ class NamedDecl : public Decl {
   /// constructor, Objective-C selector, etc.)
   DeclarationName Name;
 
+private:
+  NamedDecl *getUnderlyingDeclImpl();
+
 protected:
   NamedDecl(Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
     : Decl(DK, DC, L), Name(N) { }
@@ -324,12 +327,13 @@ public:
   /// \brief Looks through UsingDecls and ObjCCompatibleAliasDecls for
   /// the underlying named decl.
   NamedDecl *getUnderlyingDecl() {
-    if (!(this->getKind() == UsingShadow) &&
-        !(this->getKind() == ObjCCompatibleAlias))
+    // Fast-path the common case.
+    if (this->getKind() != UsingShadow &&
+        this->getKind() != ObjCCompatibleAlias)
       return this;
+
     return getUnderlyingDeclImpl();
   }
-  NamedDecl *getUnderlyingDeclImpl();
   const NamedDecl *getUnderlyingDecl() const {
     return const_cast<NamedDecl*>(this)->getUnderlyingDecl();
   }