[cfe-commits] r152332 - /cfe/trunk/include/clang/AST/Decl.h
Daniel Dunbar
daniel at zuster.org
Thu Mar 8 12:29:03 PST 2012
Author: ddunbar
Date: Thu Mar 8 14:29:02 2012
New Revision: 152332
URL: http://llvm.org/viewvc/llvm-project?rev=152332&view=rev
Log:
[AST] Clean up NamedDecl::getUnderlyingDecl() change a bit.
Modified:
cfe/trunk/include/clang/AST/Decl.h
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=152332&r1=152331&r2=152332&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Thu Mar 8 14:29:02 2012
@@ -106,6 +106,9 @@
/// 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 @@
/// \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();
}
More information about the cfe-commits
mailing list