diff options
author | David Blaikie <dblaikie@gmail.com> | 2018-12-12 19:53:03 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2018-12-12 19:53:03 +0000 |
commit | 023674a9e4870a6fbfb20b38d4f1c3a60368785d (patch) | |
tree | 28acbcf2fe2a50b4817127931573de662af7855d /llvm/lib/DebugInfo | |
parent | f5b36e56fb4d89eab442559a37239eeafe7690d3 (diff) | |
download | bcm5719-llvm-023674a9e4870a6fbfb20b38d4f1c3a60368785d.tar.gz bcm5719-llvm-023674a9e4870a6fbfb20b38d4f1c3a60368785d.zip |
DebugInfo/DWARF: Pretty print subroutine types
Doesn't handle varargs and other fun things, but it's a start. (also
doesn't print these strictly as valid C++ when it's a pointer to
function, it'll print as "void(int)*" instead of "void (*)(int)")
llvm-svn: 348965
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDie.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp index b70a4f09776..551e292fb03 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -173,17 +173,34 @@ static void dumpTypeName(raw_ostream &OS, const DWARFDie &D) { case DW_TAG_ptr_to_member_type: case DW_TAG_reference_type: case DW_TAG_rvalue_reference_type: + case DW_TAG_subroutine_type: break; default: dumpTypeTagName(OS, T); } // Follow the DW_AT_type if possible. - dumpTypeName(OS, D.getAttributeValueAsReferencedDie(DW_AT_type)); + DWARFDie TypeDie = D.getAttributeValueAsReferencedDie(DW_AT_type); + dumpTypeName(OS, TypeDie); switch (T) { + case DW_TAG_subroutine_type: { + if (!TypeDie) + OS << "void"; + OS << '('; + bool First = true; + for (const DWARFDie &C : D.children()) { + if (C.getTag() == DW_TAG_formal_parameter) { + if (!First) + OS << ", "; + First = false; + dumpTypeName(OS, C.getAttributeValueAsReferencedDie(DW_AT_type)); + } + } + OS << ')'; + break; + } case DW_TAG_array_type: { - Optional<uint64_t> Bound; for (const DWARFDie &C : D.children()) if (C.getTag() == DW_TAG_subrange_type) { |