summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-04-11 00:43:52 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-04-11 00:43:52 +0000
commit1e0fc8fe5b698946c3c581fd7e0f3148c1df2a38 (patch)
tree1a80ca519dd93270f4b602a1c0bde3e796c62c5f /llvm/lib/MC/MCDwarf.cpp
parent3fefedb24c4e5f3710c71ba03b2091d0aec830c1 (diff)
downloadbcm5719-llvm-1e0fc8fe5b698946c3c581fd7e0f3148c1df2a38.tar.gz
bcm5719-llvm-1e0fc8fe5b698946c3c581fd7e0f3148c1df2a38.zip
Use value types instead of 'new'd objects to store dwarf labels for asm files
llvm-svn: 206009
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 72836ff32ec..88cb6236232 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -727,28 +727,24 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
// Third part: the list of label DIEs.
// Loop on saved info for dwarf labels and create the DIEs for them.
- const std::vector<const MCGenDwarfLabelEntry *> &Entries =
- MCOS->getContext().getMCGenDwarfLabelEntries();
- for (std::vector<const MCGenDwarfLabelEntry *>::const_iterator it =
- Entries.begin(), ie = Entries.end(); it != ie;
- ++it) {
- const MCGenDwarfLabelEntry *Entry = *it;
-
+ const std::vector<MCGenDwarfLabelEntry> &Entries =
+ MCOS->getContext().getMCGenDwarfLabelEntries();
+ for (const auto &Entry : Entries) {
// The DW_TAG_label DIE abbrev (2).
MCOS->EmitULEB128IntValue(2);
// AT_name, of the label without any leading underbar.
- MCOS->EmitBytes(Entry->getName());
+ MCOS->EmitBytes(Entry.getName());
MCOS->EmitIntValue(0, 1); // NULL byte to terminate the string.
// AT_decl_file, index into the file table.
- MCOS->EmitIntValue(Entry->getFileNumber(), 4);
+ MCOS->EmitIntValue(Entry.getFileNumber(), 4);
// AT_decl_line, source line number.
- MCOS->EmitIntValue(Entry->getLineNumber(), 4);
+ MCOS->EmitIntValue(Entry.getLineNumber(), 4);
// AT_low_pc, start address of the label.
- const MCExpr *AT_low_pc = MCSymbolRefExpr::Create(Entry->getLabel(),
+ const MCExpr *AT_low_pc = MCSymbolRefExpr::Create(Entry.getLabel(),
MCSymbolRefExpr::VK_None, context);
MCOS->EmitValue(AT_low_pc, AddrSize);
@@ -761,14 +757,6 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
// Add the NULL DIE terminating the DW_TAG_unspecified_parameters DIE's.
MCOS->EmitIntValue(0, 1);
}
- // Deallocate the MCGenDwarfLabelEntry classes that saved away the info
- // for the dwarf labels.
- for (std::vector<const MCGenDwarfLabelEntry *>::const_iterator it =
- Entries.begin(), ie = Entries.end(); it != ie;
- ++it) {
- const MCGenDwarfLabelEntry *Entry = *it;
- delete Entry;
- }
// Add the NULL DIE terminating the Compile Unit DIE's.
MCOS->EmitIntValue(0, 1);
@@ -856,9 +844,8 @@ void MCGenDwarfLabelEntry::Make(MCSymbol *Symbol, MCStreamer *MCOS,
MCOS->EmitLabel(Label);
// Create and entry for the info and add it to the other entries.
- MCGenDwarfLabelEntry *Entry =
- new MCGenDwarfLabelEntry(Name, FileNumber, LineNumber, Label);
- MCOS->getContext().addMCGenDwarfLabelEntry(Entry);
+ MCOS->getContext().addMCGenDwarfLabelEntry(
+ MCGenDwarfLabelEntry(Name, FileNumber, LineNumber, Label));
}
static int getDataAlignmentFactor(MCStreamer &streamer) {
OpenPOWER on IntegriCloud