DIBuilder: Add function and method definitions to the list of all subprograms
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 18 Feb 2013 07:10:22 +0000 (07:10 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 18 Feb 2013 07:10:22 +0000 (07:10 +0000)
Previously we seemed to be assuming that all functions were definitions and all
methods were declarations. This may be consistent with how Clang uses DIBuilder
but doesn't have to be true of all clients (such as DragonEgg).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175423 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/DIBuilder.cpp

index af055c9f2fa5fd95aa309c77a7442ef8fbf4d342..2fe13c44c6301ed2f9ceaeb0ec1d7bbf5d9d8faa 100644 (file)
@@ -924,7 +924,8 @@ DISubprogram DIBuilder::createFunction(DIDescriptor Context,
   MDNode *Node = MDNode::get(VMContext, Elts);
 
   // Create a named metadata so that we do not lose this mdnode.
-  AllSubprograms.push_back(Node);
+  if (isDefinition)
+    AllSubprograms.push_back(Node);
   return DISubprogram(Node);
 }
 
@@ -968,6 +969,8 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context,
     ConstantInt::get(Type::getInt32Ty(VMContext), LineNo)
   };
   MDNode *Node = MDNode::get(VMContext, Elts);
+  if (isDefinition)
+    AllSubprograms.push_back(Node);
   return DISubprogram(Node);
 }