1 //===- DebugLocStream.cpp - DWARF debug_loc stream --------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "DebugLocStream.h"
11 #include "DwarfDebug.h"
12 #include "llvm/CodeGen/AsmPrinter.h"
16 bool DebugLocStream::finalizeList(AsmPrinter &Asm) {
17 if (Lists.back().EntryOffset == Entries.size()) {
18 // Empty list. Delete it.
23 // Real list. Generate a label for it.
24 Lists.back().Label = Asm.createTempSymbol("debug_loc");
28 void DebugLocStream::finalizeEntry() {
29 if (Entries.back().ByteOffset != DWARFBytes.size())
32 // The last entry was empty. Delete it.
33 Comments.erase(Comments.begin() + Entries.back().CommentOffset,
37 assert(Lists.back().EntryOffset <= Entries.size() &&
38 "Popped off more entries than are in the list");
41 DebugLocStream::ListBuilder::~ListBuilder() {
42 if (!Locs.finalizeList(Asm))
44 V.initializeDbgValue(&MI);
45 V.setDebugLocListIndex(ListIndex);