]> granicus.if.org Git - clang/commitdiff
Minor optimization; if we have a CXXRecordDecl we can get the definition decl directl...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 19 Oct 2010 18:06:47 +0000 (18:06 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 19 Oct 2010 18:06:47 +0000 (18:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116837 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Decl.cpp

index e822009c58021ca458194fd9e5fb30422f804e39..4898d6f2fc0cde23b404e9b51ea7795d2bb0579d 100644 (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)