r189494 - PR16995: Failing to associate static members with their enclosing class

David Blaikie dblaikie at gmail.com
Wed Aug 28 10:27:14 PDT 2013


Author: dblaikie
Date: Wed Aug 28 12:27:13 2013
New Revision: 189494

URL: http://llvm.org/viewvc/llvm-project?rev=189494&view=rev
Log:
PR16995: Failing to associate static members with their enclosing class

In the transition from declaration (with some members) to definition, we
were overwriting the list of members with the empty list when attaching
template parameters.

The fix is in llvm::DICompositeType::addMember (along with asserts that
cause this bug to be covered by existing Clang test cases), including
adding some asserts to catch this sort of issue which found issues fixed
in this commit.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=189494&r1=189493&r2=189494&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Aug 28 12:27:13 2013
@@ -1122,17 +1122,14 @@ CollectCXXMemberFunctions(const CXXRecor
   // the functions.
   for(DeclContext::decl_iterator I = RD->decls_begin(),
         E = RD->decls_end(); I != E; ++I) {
-    Decl *D = *I;
-    if (D->isImplicit())
-      continue;
-
-    if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {
+    if (const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(*I)) {
       // Reuse the existing member function declaration if it exists
       llvm::DenseMap<const FunctionDecl *, llvm::WeakVH>::iterator MI =
           SPCache.find(Method->getCanonicalDecl());
-      if (MI == SPCache.end())
-        EltTys.push_back(CreateCXXMemberFunction(Method, Unit, RecordTy));
-      else
+      if (MI == SPCache.end()) {
+        if (!Method->isImplicit())
+          EltTys.push_back(CreateCXXMemberFunction(Method, Unit, RecordTy));
+      } else
         EltTys.push_back(MI->second);
     }
   }





More information about the cfe-commits mailing list