[cfe-commits] r152321 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/Decl.cpp
Daniel Dunbar
daniel at zuster.org
Thu Mar 8 10:20:41 PST 2012
Author: ddunbar
Date: Thu Mar 8 12:20:41 2012
New Revision: 152321
URL: http://llvm.org/viewvc/llvm-project?rev=152321&view=rev
Log:
[AST] Change NamedDecl::getUnderlyingDecl() to inline the fast (and incredibly common) path.
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=152321&r1=152320&r2=152321&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Thu Mar 8 12:20:41 2012
@@ -323,7 +323,13 @@
/// \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();
}
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=152321&r1=152320&r2=152321&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu Mar 8 12:20:41 2012
@@ -983,7 +983,7 @@
return getLinkage() != NoLinkage;
}
-NamedDecl *NamedDecl::getUnderlyingDecl() {
+NamedDecl *NamedDecl::getUnderlyingDeclImpl() {
NamedDecl *ND = this;
while (true) {
if (UsingShadowDecl *UD = dyn_cast<UsingShadowDecl>(ND))
More information about the cfe-commits
mailing list