summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp12
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp6
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp6
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp31
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp4
5 files changed, 27 insertions, 32 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
index afae00ec432..9314c9eabc4 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
@@ -62,23 +62,23 @@ DWARFAbbreviationDeclaration::extract(DataExtractor Data, uint32_t* OffsetPtr) {
}
void DWARFAbbreviationDeclaration::dump(raw_ostream &OS) const {
- auto tagString = TagString(getTag());
+ const char *tagString = TagString(getTag());
OS << '[' << getCode() << "] ";
- if (!tagString.empty())
+ if (tagString)
OS << tagString;
else
OS << format("DW_TAG_Unknown_%x", getTag());
OS << "\tDW_CHILDREN_" << (hasChildren() ? "yes" : "no") << '\n';
for (const AttributeSpec &Spec : AttributeSpecs) {
OS << '\t';
- auto attrString = AttributeString(Spec.Attr);
- if (!attrString.empty())
+ const char *attrString = AttributeString(Spec.Attr);
+ if (attrString)
OS << attrString;
else
OS << format("DW_AT_Unknown_%x", Spec.Attr);
OS << '\t';
- auto formString = FormEncodingString(Spec.Form);
- if (!formString.empty())
+ const char *formString = FormEncodingString(Spec.Form);
+ if (formString)
OS << formString;
else
OS << format("DW_FORM_Unknown_%x", Spec.Form);
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
index 9aa3a2bf1bf..8ae05432869 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
@@ -61,14 +61,12 @@ void DWARFAcceleratorTable::dump(raw_ostream &OS) const {
SmallVector<DWARFFormValue, 3> AtomForms;
for (const auto &Atom: HdrData.Atoms) {
OS << format("Atom[%d] Type: ", i++);
- auto TypeString = dwarf::AtomTypeString(Atom.first);
- if (!TypeString.empty())
+ if (const char *TypeString = dwarf::AtomTypeString(Atom.first))
OS << TypeString;
else
OS << format("DW_ATOM_Unknown_0x%x", Atom.first);
OS << " Form: ";
- auto FormString = dwarf::FormEncodingString(Atom.second);
- if (!FormString.empty())
+ if (const char *FormString = dwarf::FormEncodingString(Atom.second))
OS << FormString;
else
OS << format("DW_FORM_Unknown_0x%x", Atom.second);
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
index 046559e02c3..4253401cf22 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
@@ -394,15 +394,13 @@ static void printOperand(raw_ostream &OS, uint8_t Opcode, unsigned OperandIdx,
OperandType Type = OpTypes[Opcode][OperandIdx];
switch (Type) {
- case OT_Unset: {
+ case OT_Unset:
OS << " Unsupported " << (OperandIdx ? "second" : "first") << " operand to";
- auto OpcodeName = CallFrameString(Opcode);
- if (!OpcodeName.empty())
+ if (const char *OpcodeName = CallFrameString(Opcode))
OS << " " << OpcodeName;
else
OS << format(" Opcode %x", Opcode);
break;
- }
case OT_None:
break;
case OT_Address:
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
index c43456b1c57..62d5e666aef 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
@@ -45,12 +45,12 @@ void DWARFDebugInfoEntryMinimal::dump(raw_ostream &OS, DWARFUnit *u,
if (abbrCode) {
if (AbbrevDecl) {
- auto tagString = TagString(getTag());
- if (!tagString.empty())
- WithColor(OS, syntax::Tag).get().indent(indent) << tagString;
- else
- WithColor(OS, syntax::Tag).get().indent(indent)
- << format("DW_TAG_Unknown_%x", getTag());
+ const char *tagString = TagString(getTag());
+ if (tagString)
+ WithColor(OS, syntax::Tag).get().indent(indent) << tagString;
+ else
+ WithColor(OS, syntax::Tag).get().indent(indent) <<
+ format("DW_TAG_Unknown_%x", getTag());
OS << format(" [%u] %c\n", abbrCode,
AbbrevDecl->hasChildren() ? '*' : ' ');
@@ -83,8 +83,7 @@ static void dumpApplePropertyAttribute(raw_ostream &OS, uint64_t Val) {
uint64_t Shift = countTrailingZeros(Val);
assert(Shift < 64 && "undefined behavior");
uint64_t Bit = 1ULL << Shift;
- auto PropName = ApplePropertyString(Bit);
- if (!PropName.empty())
+ if (const char *PropName = ApplePropertyString(Bit))
OS << PropName;
else
OS << format("DW_APPLE_PROPERTY_0x%" PRIx64, Bit);
@@ -117,14 +116,14 @@ void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS,
const char BaseIndent[] = " ";
OS << BaseIndent;
OS.indent(indent+2);
- auto attrString = AttributeString(attr);
- if (!attrString.empty())
+ const char *attrString = AttributeString(attr);
+ if (attrString)
WithColor(OS, syntax::Attribute) << attrString;
else
WithColor(OS, syntax::Attribute).get() << format("DW_AT_Unknown_%x", attr);
- auto formString = FormEncodingString(form);
- if (!formString.empty())
+ const char *formString = FormEncodingString(form);
+ if (formString)
OS << " [" << formString << ']';
else
OS << format(" [DW_FORM_Unknown_%x]", form);
@@ -135,8 +134,8 @@ void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS,
return;
OS << "\t(";
-
- StringRef Name;
+
+ const char *Name = nullptr;
std::string File;
auto Color = syntax::Enumerator;
if (attr == DW_AT_decl_file || attr == DW_AT_call_file) {
@@ -147,12 +146,12 @@ void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS,
u->getCompilationDir(),
DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, File)) {
File = '"' + File + '"';
- Name = File;
+ Name = File.c_str();
}
} else if (Optional<uint64_t> Val = formValue.getAsUnsignedConstant())
Name = AttributeValueString(attr, *Val);
- if (!Name.empty())
+ if (Name)
WithColor(OS, Color) << Name;
else if (attr == DW_AT_decl_line || attr == DW_AT_call_line)
OS << *formValue.getAsUnsignedConstant();
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 1635808e002..63d22d84121 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -42,8 +42,8 @@ void DWARFDebugLine::Prologue::dump(raw_ostream &OS) const {
<< format(" opcode_base: %u\n", OpcodeBase);
for (uint32_t i = 0; i < StandardOpcodeLengths.size(); ++i)
- OS << format("standard_opcode_lengths[%s] = %u\n",
- LNStandardString(i + 1).data(), StandardOpcodeLengths[i]);
+ OS << format("standard_opcode_lengths[%s] = %u\n", LNStandardString(i + 1),
+ StandardOpcodeLengths[i]);
if (!IncludeDirectories.empty())
for (uint32_t i = 0; i < IncludeDirectories.size(); ++i)
OpenPOWER on IntegriCloud