diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-10-19 18:06:47 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-10-19 18:06:47 +0000 |
commit | 0a2e0976d60264724b9a1e39d3f63660c94b607d (patch) | |
tree | 206afb50b7f1550491a3b342dad7b3ce1679b94c /lib/AST/Decl.cpp | |
parent | 1d2a4311da8b332fd309992c1a426420722e4ac5 (diff) |
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
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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<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) |