diff options
author | dim <dim@FreeBSD.org> | 2015-07-05 14:21:36 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-07-05 14:21:36 +0000 |
commit | d2fc7c7001ed3babcd0106d15dd70224abfb6f29 (patch) | |
tree | 7c411f9b5d807f7f204fdd16965d8925a82b6d18 /lib/CodeGen/AsmPrinter/DebugLocStream.cpp | |
parent | 60174f118de85cbcad51deb11c650f22c9be2235 (diff) | |
download | FreeBSD-src-d2fc7c7001ed3babcd0106d15dd70224abfb6f29.zip FreeBSD-src-d2fc7c7001ed3babcd0106d15dd70224abfb6f29.tar.gz |
Vendor import of llvm trunk r241361:
https://llvm.org/svn/llvm-project/llvm/trunk@241361
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DebugLocStream.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DebugLocStream.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/DebugLocStream.cpp b/lib/CodeGen/AsmPrinter/DebugLocStream.cpp new file mode 100644 index 0000000..7e8ed71 --- /dev/null +++ b/lib/CodeGen/AsmPrinter/DebugLocStream.cpp @@ -0,0 +1,46 @@ +//===- DebugLocStream.cpp - DWARF debug_loc stream --------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "DebugLocStream.h" +#include "DwarfDebug.h" +#include "llvm/CodeGen/AsmPrinter.h" + +using namespace llvm; + +bool DebugLocStream::finalizeList(AsmPrinter &Asm) { + if (Lists.back().EntryOffset == Entries.size()) { + // Empty list. Delete it. + Lists.pop_back(); + return false; + } + + // Real list. Generate a label for it. + Lists.back().Label = Asm.createTempSymbol("debug_loc"); + return true; +} + +void DebugLocStream::finalizeEntry() { + if (Entries.back().ByteOffset != DWARFBytes.size()) + return; + + // The last entry was empty. Delete it. + Comments.erase(Comments.begin() + Entries.back().CommentOffset, + Comments.end()); + Entries.pop_back(); + + assert(Lists.back().EntryOffset <= Entries.size() && + "Popped off more entries than are in the list"); +} + +DebugLocStream::ListBuilder::~ListBuilder() { + if (!Locs.finalizeList(Asm)) + return; + V.initializeDbgValue(&MI); + V.setDebugLocListIndex(ListIndex); +} |