From c8074aa654da982e1169e889da08bc1d93536754 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 28 Aug 2018 22:29:12 +0000 Subject: [codeview] Emit labels for .cv_loc immediately Previously we followed the DWARF implementation, which waits until the next instruction or data to emit the label to use in the .debug_loc section. We might want to consider re-evaluating that design choice as well, since it means the .loc skips alignment padding, for better or worse. This was the most minimal fix I could come up with, but we should be able to do a lot of cleanups now that we don't need to save a pending CV location on the CodeViewContext. I plan to do those next, but this immediately fixes an assertion for some of our users. llvm-svn: 340878 --- llvm/lib/MC/MCObjectStreamer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/MC/MCObjectStreamer.cpp') diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 102aa4d4513..9a55ac0a84a 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -446,12 +446,12 @@ void MCObjectStreamer::EmitCVLocDirective(unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt, StringRef FileName, SMLoc Loc) { - // In case we see two .cv_loc directives in a row, make sure the - // first one gets a line entry. - MCCVLineEntry::Make(this); - + // Unlike dwarf locations, we don't save the MCCVLineEntry until the next + // instruction. We create the label exactly where the directive appears in the + // assembly. this->MCStreamer::EmitCVLocDirective(FunctionId, FileNo, Line, Column, PrologueEnd, IsStmt, FileName, Loc); + MCCVLineEntry::Make(this); } void MCObjectStreamer::EmitCVLinetableDirective(unsigned FunctionId, -- cgit v1.2.3