From 0a2e0976d60264724b9a1e39d3f63660c94b607d Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 19 Oct 2010 18:06:47 +0000 Subject: [PATCH] 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 --- lib/AST/Decl.cpp | 2 ++ 1 file changed, 2 insertions(+) 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) -- 2.40.0