From: Argyrios Kyrtzidis Date: Tue, 19 Oct 2010 18:06:47 +0000 (+0000) Subject: Minor optimization; if we have a CXXRecordDecl we can get the definition decl directl... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a2e0976d60264724b9a1e39d3f63660c94b607d;p=clang Minor optimization; if we have a CXXRecordDecl we can get the definition decl directly without iterating over the redeclarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116837 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index e822009c58..4898d6f2fc 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1580,6 +1580,8 @@ void TagDecl::completeDefinition() { TagDecl* TagDecl::getDefinition() const { if (isDefinition()) return const_cast(this); + if (const CXXRecordDecl *CXXRD = dyn_cast(this)) + return CXXRD->getDefinition(); for (redecl_iterator R = redecls_begin(), REnd = redecls_end(); R != REnd; ++R)