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 | 54e6197d5aec4713fb8e63ed4799958c0281be36 (patch) | |
| tree | 8173ee364519c3f842e703e9cc2a2fde925e279c /clang/lib/AST/Decl.cpp | |
| parent | 40338af47d39422c39eca621f797e8eba574037f (diff) | |
| download | bcm5719-llvm-54e6197d5aec4713fb8e63ed4799958c0281be36.tar.gz bcm5719-llvm-54e6197d5aec4713fb8e63ed4799958c0281be36.zip | |
Minor optimization; if we have a CXXRecordDecl we can get the definition decl directly without iterating over the redeclarations.
llvm-svn: 116837
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index e822009c580..4898d6f2fc0 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/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) |

