Skip to content

Commit aa1d2cc

Browse files
committed
1 parent d7f409d commit aa1d2cc

File tree

10 files changed

+25
-104
lines changed

10 files changed

+25
-104
lines changed

llvm/include/llvm/MC/MCObjectStreamer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ class MCObjectStreamer : public MCStreamer {
141141
SMLoc Loc) override;
142142
void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column,
143143
unsigned Flags, unsigned Isa,
144-
unsigned Discriminator, StringRef FileName,
145-
StringRef Comment = {}) override;
144+
unsigned Discriminator,
145+
StringRef FileName) override;
146146
void emitDwarfAdvanceLineAddr(int64_t LineDelta, const MCSymbol *LastLabel,
147147
const MCSymbol *Label,
148148
unsigned PointerSize) override;

llvm/include/llvm/MC/MCStreamer.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,8 +887,7 @@ class MCStreamer {
887887
virtual void emitDwarfLocDirective(unsigned FileNo, unsigned Line,
888888
unsigned Column, unsigned Flags,
889889
unsigned Isa, unsigned Discriminator,
890-
StringRef FileName,
891-
StringRef Comment = {});
890+
StringRef FileName);
892891

893892
/// This implements the '.loc_label Name' directive.
894893
virtual void emitDwarfLocLabelDirective(SMLoc Loc, StringRef Name);

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,14 +2057,6 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
20572057
}
20582058
}
20592059

2060-
auto RecordSourceLine = [&](auto &DL, auto Flags) {
2061-
SmallString<128> LocationString;
2062-
raw_svector_ostream OS(LocationString);
2063-
DL.print(OS);
2064-
2065-
const MDNode *Scope = DL.getScope();
2066-
recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags, LocationString);
2067-
};
20682060
// When we emit a line-0 record, we don't update PrevInstLoc; so look at
20692061
// the last line number actually emitted, to see if it was line 0.
20702062
unsigned LastAsmLine =
@@ -2092,7 +2084,8 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
20922084
// But we might be coming back to it after a line 0 record.
20932085
if ((LastAsmLine == 0 && DL.getLine() != 0) || Flags) {
20942086
// Reinstate the source location but not marked as a statement.
2095-
RecordSourceLine(DL, Flags);
2087+
const MDNode *Scope = DL.getScope();
2088+
recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
20962089
}
20972090
return;
20982091
}
@@ -2143,7 +2136,8 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) {
21432136
if (DL.getLine() && (DL.getLine() != OldLine || ForceIsStmt))
21442137
Flags |= DWARF2_FLAG_IS_STMT;
21452138

2146-
RecordSourceLine(DL, Flags);
2139+
const MDNode *Scope = DL.getScope();
2140+
recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
21472141

21482142
// If we're not at line 0, remember this location.
21492143
if (DL.getLine())
@@ -2278,8 +2272,7 @@ findPrologueEndLoc(const MachineFunction *MF) {
22782272
static void recordSourceLine(AsmPrinter &Asm, unsigned Line, unsigned Col,
22792273
const MDNode *S, unsigned Flags, unsigned CUID,
22802274
uint16_t DwarfVersion,
2281-
ArrayRef<std::unique_ptr<DwarfCompileUnit>> DCUs,
2282-
StringRef Comment = {}) {
2275+
ArrayRef<std::unique_ptr<DwarfCompileUnit>> DCUs) {
22832276
StringRef Fn;
22842277
unsigned FileNo = 1;
22852278
unsigned Discriminator = 0;
@@ -2293,7 +2286,7 @@ static void recordSourceLine(AsmPrinter &Asm, unsigned Line, unsigned Col,
22932286
.getOrCreateSourceID(Scope->getFile());
22942287
}
22952288
Asm.OutStreamer->emitDwarfLocDirective(FileNo, Line, Col, Flags, 0,
2296-
Discriminator, Fn, Comment);
2289+
Discriminator, Fn);
22972290
}
22982291

22992292
const MachineInstr *
@@ -2624,10 +2617,10 @@ void DwarfDebug::endFunctionImpl(const MachineFunction *MF) {
26242617
// Register a source line with debug info. Returns the unique label that was
26252618
// emitted and which provides correspondence to the source line list.
26262619
void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S,
2627-
unsigned Flags, StringRef Location) {
2620+
unsigned Flags) {
26282621
::recordSourceLine(*Asm, Line, Col, S, Flags,
26292622
Asm->OutStreamer->getContext().getDwarfCompileUnitID(),
2630-
getDwarfVersion(), getUnits(), Location);
2623+
getDwarfVersion(), getUnits());
26312624
}
26322625

26332626
//===----------------------------------------------------------------------===//

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ class DwarfDebug : public DebugHandlerBase {
679679
/// label that was emitted and which provides correspondence to the
680680
/// source line list.
681681
void recordSourceLine(unsigned Line, unsigned Col, const MDNode *Scope,
682-
unsigned Flags, StringRef Location = {});
682+
unsigned Flags);
683683

684684
/// Populate LexicalScope entries with variables' info.
685685
void collectEntityInfo(DwarfCompileUnit &TheCU, const DISubprogram *SP,

llvm/lib/MC/MCAsmStreamer.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ class MCAsmStreamer final : public MCStreamer {
294294
unsigned CUID = 0) override;
295295
void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column,
296296
unsigned Flags, unsigned Isa,
297-
unsigned Discriminator, StringRef FileName,
298-
StringRef Location = {}) override;
297+
unsigned Discriminator,
298+
StringRef FileName) override;
299299
virtual void emitDwarfLocLabelDirective(SMLoc Loc, StringRef Name) override;
300300

301301
MCSymbol *getDwarfLineTableSymbol(unsigned CUID) override;
@@ -1688,16 +1688,15 @@ void MCAsmStreamer::emitDwarfFile0Directive(
16881688
void MCAsmStreamer::emitDwarfLocDirective(unsigned FileNo, unsigned Line,
16891689
unsigned Column, unsigned Flags,
16901690
unsigned Isa, unsigned Discriminator,
1691-
StringRef FileName,
1692-
StringRef Comment) {
1691+
StringRef FileName) {
16931692
// If target doesn't support .loc/.file directive, we need to record the lines
16941693
// same way like we do in object mode.
16951694
if (MAI->isAIX()) {
16961695
// In case we see two .loc directives in a row, make sure the
16971696
// first one gets a line entry.
16981697
MCDwarfLineEntry::make(this, getCurrentSectionOnly());
16991698
this->MCStreamer::emitDwarfLocDirective(FileNo, Line, Column, Flags, Isa,
1700-
Discriminator, FileName, Comment);
1699+
Discriminator, FileName);
17011700
return;
17021701
}
17031702

@@ -1728,15 +1727,12 @@ void MCAsmStreamer::emitDwarfLocDirective(unsigned FileNo, unsigned Line,
17281727

17291728
if (IsVerboseAsm) {
17301729
OS.PadToColumn(MAI->getCommentColumn());
1731-
OS << MAI->getCommentString() << ' ';
1732-
if (Comment.empty())
1733-
OS << FileName << ':' << Line << ':' << Column;
1734-
else
1735-
OS << Comment;
1730+
OS << MAI->getCommentString() << ' ' << FileName << ':'
1731+
<< Line << ':' << Column;
17361732
}
17371733
EmitEOL();
17381734
this->MCStreamer::emitDwarfLocDirective(FileNo, Line, Column, Flags, Isa,
1739-
Discriminator, FileName, Comment);
1735+
Discriminator, FileName);
17401736
}
17411737

17421738
void MCAsmStreamer::emitDwarfLocLabelDirective(SMLoc Loc, StringRef Name) {

llvm/lib/MC/MCObjectStreamer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,14 +418,13 @@ void MCObjectStreamer::emitDwarfLocDirective(unsigned FileNo, unsigned Line,
418418
unsigned Column, unsigned Flags,
419419
unsigned Isa,
420420
unsigned Discriminator,
421-
StringRef FileName,
422-
StringRef Comment) {
421+
StringRef FileName) {
423422
// In case we see two .loc directives in a row, make sure the
424423
// first one gets a line entry.
425424
MCDwarfLineEntry::make(this, getCurrentSectionOnly());
426425

427426
this->MCStreamer::emitDwarfLocDirective(FileNo, Line, Column, Flags, Isa,
428-
Discriminator, FileName, Comment);
427+
Discriminator, FileName);
429428
}
430429

431430
static const MCExpr *buildSymbolDiff(MCObjectStreamer &OS, const MCSymbol *A,

llvm/lib/MC/MCStreamer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void MCStreamer::emitCFIMTETaggedFrame() {
238238
void MCStreamer::emitDwarfLocDirective(unsigned FileNo, unsigned Line,
239239
unsigned Column, unsigned Flags,
240240
unsigned Isa, unsigned Discriminator,
241-
StringRef FileName, StringRef Comment) {
241+
StringRef FileName) {
242242
getContext().setCurrentDwarfLoc(FileNo, Line, Column, Flags, Isa,
243243
Discriminator);
244244
}

llvm/test/CodeGen/AMDGPU/dbg-info-inline-at.ll

Lines changed: 0 additions & 66 deletions
This file was deleted.

llvm/test/CodeGen/XCore/dwarf_debug.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
; CHECK-LABEL: f
77
; CHECK: entsp [[S:[0-9]+]]
88
; ...the prologue...
9-
; CHECK: .loc 1 2 0 prologue_end # test.c:2
9+
; CHECK: .loc 1 2 0 prologue_end # test.c:2:0
1010
; CHECK: add r0, r0, 1
1111
; CHECK: retsp [[S]]
1212
define i32 @f(i32 %a) !dbg !4 {

llvm/test/DebugInfo/X86/inline-seldag-test.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
; Make sure the condition test is attributed to the inline function, not the
1919
; location of the test's operands within the caller.
2020

21-
; ASM: # inline-seldag-test.c:4:0
22-
; ASM: .loc 1 2 0 # inline-seldag-test.c:2 @[ inline-seldag-test.c:6:7 ]
21+
; ASM: # inline-seldag-test.c:2:0
22+
; ASM-NOT: .loc
2323
; ASM: testl
2424

2525
; Function Attrs: nounwind uwtable

0 commit comments

Comments
 (0)