[cfe-commits] r116837 - /cfe/trunk/lib/AST/Decl.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Oct 19 11:06:47 PDT 2010


Author: akirtzidis
Date: Tue Oct 19 13:06:47 2010
New Revision: 116837

URL: http://llvm.org/viewvc/llvm-project?rev=116837&view=rev
Log:
Minor optimization; if we have a CXXRecordDecl we can get the definition decl directly without iterating over the redeclarations.

Modified:
    cfe/trunk/lib/AST/Decl.cpp

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=116837&r1=116836&r2=116837&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Tue Oct 19 13:06:47 2010
@@ -1580,6 +1580,8 @@
 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)





More information about the cfe-commits mailing list