]> granicus.if.org Git - clang/commitdiff
Tie constructor defintion with its declaration using AT_specification.
authorDevang Patel <dpatel@apple.com>
Fri, 29 Apr 2011 23:42:32 +0000 (23:42 +0000)
committerDevang Patel <dpatel@apple.com>
Fri, 29 Apr 2011 23:42:32 +0000 (23:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130561 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index 4b2b9085169006ea1f22c0406ec775f8681243e8..87b02acec7b9a52dcd60b207d7d6df11bbbca797 100644 (file)
@@ -772,10 +772,7 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method,
                           Virtuality, VIndex, ContainingType,
                           Flags, CGM.getLangOptions().Optimize);
   
-  // Don't cache ctors or dtors since we have to emit multiple functions for
-  // a single ctor or dtor.
-  if (!IsCtorOrDtor)
-    SPCache[Method] = llvm::WeakVH(SP);
+  SPCache[Method] = llvm::WeakVH(SP);
 
   return SP;
 }
@@ -1592,6 +1589,14 @@ llvm::DISubprogram CGDebugInfo::getFunctionDeclaration(const Decl *D) {
   // Setup context.
   getContextDescriptor(cast<Decl>(D->getDeclContext()));
 
+  llvm::DenseMap<const FunctionDecl *, llvm::WeakVH>::iterator
+    MI = SPCache.find(FD);
+  if (MI != SPCache.end()) {
+    llvm::DISubprogram SP(dyn_cast_or_null<llvm::MDNode>(&*MI->second));
+    if (SP.isSubprogram() && !llvm::DISubprogram(SP).isDefinition())
+      return SP;
+  }
+
   for (FunctionDecl::redecl_iterator I = FD->redecls_begin(),
          E = FD->redecls_end(); I != E; ++I) {
     const FunctionDecl *NextFD = *I;