DebugInfo: Use the scope of the function declaration, if any, to name a function...
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfUnit.cpp
index 33cdcefb71ccc99592a2023aa43732a8f5a970ba..a42897f18f13863155d20e1b277f134bc619a3f1 100644 (file)
@@ -1401,6 +1401,13 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
   return &SPDie;
 }
 
+void DwarfUnit::applySubprogramAttributesToDefinition(DISubprogram SP, DIE &SPDie) {
+  DISubprogram SPDecl = SP.getFunctionDeclaration();
+  DIScope Context = resolve(SPDecl ? SPDecl.getContext() : SP.getContext());
+  applySubprogramAttributes(SP, SPDie);
+  addGlobalName(SP.getName(), SPDie, Context);
+}
+
 void DwarfUnit::applySubprogramAttributes(DISubprogram SP, DIE &SPDie) {
   DIE *DeclDie = nullptr;
   StringRef DeclLinkageName;