Minor optimization; if we have a CXXRecordDecl we can get the definition decl directly without iterating over the redeclarations.

llvm-svn: 116837
This commit is contained in:
Argyrios Kyrtzidis 2010-10-19 18:06:47 +00:00
parent 40338af47d
commit 54e6197d5a
1 changed files with 2 additions and 0 deletions

View File

@ -1580,6 +1580,8 @@ void TagDecl::completeDefinition() {
TagDecl* TagDecl::getDefinition() const {
if (isDefinition())
return const_cast<TagDecl *>(this);
if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(this))
return CXXRD->getDefinition();
for (redecl_iterator R = redecls_begin(), REnd = redecls_end();
R != REnd; ++R)