[PATCH] D71599: [LLVM] Support to emit extern variables debuginfo with "-fstandalone-debug"
Jaydeep Chauhan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 19 11:07:52 PST 2020
Jac1494 updated this revision to Diff 239002.
Jac1494 added a comment.
DW_AT_linkage_name attribute support added for global variable declaration.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71599/new/
https://reviews.llvm.org/D71599
Files:
clang/include/clang/Basic/TargetInfo.h
clang/lib/CodeGen/CGDebugInfo.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Index: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -165,7 +165,12 @@
}
if (!GV->isDefinition())
+ {
addFlag(*VariableDIE, dwarf::DW_AT_declaration);
+
+ if (DD->useAllLinkageNames())
+ addLinkageName(*VariableDIE, GV->getLinkageName());
+ }
else
addGlobalName(GV->getName(), *VariableDIE, DeclContext);
@@ -177,6 +182,7 @@
addTemplateParams(*VariableDIE, DINodeArray(TP));
// Add location.
+ if (GV->isDefinition())
addLocationAttribute(VariableDIE, GV, GlobalExprs);
return VariableDIE;
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -4619,6 +4619,8 @@
assert(CGM.getCodeGenOpts().hasReducedDebugInfo());
if (D->hasAttr<NoDebugAttr>())
return;
+ if (!(DebugKind == clang::codegenoptions::FullDebugInfo))
+ return;
auto Align = getDeclAlignIfRequired(D, CGM.getContext());
llvm::DIFile *Unit = getOrCreateFile(D->getLocation());
Index: clang/include/clang/Basic/TargetInfo.h
===================================================================
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -1388,7 +1388,7 @@
virtual void setAuxTarget(const TargetInfo *Aux) {}
/// Whether target allows debuginfo types for decl only variables.
- virtual bool allowDebugInfoForExternalVar() const { return false; }
+ virtual bool allowDebugInfoForExternalVar() const { return true; }
protected:
/// Copy type and layout related info.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71599.239002.patch
Type: text/x-patch
Size: 1771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200119/029d6afc/attachment.bin>
More information about the llvm-commits
mailing list