Skip to content

Commit 71635ea

Browse files
committed
MCDwarf: Delete uneeded parameter
And change signature
1 parent dd5c982 commit 71635ea

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

llvm/include/llvm/MC/MCDwarf.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <cassert>
2626
#include <cstdint>
2727
#include <string>
28+
#include <tuple>
2829
#include <utility>
2930
#include <vector>
3031

@@ -387,11 +388,11 @@ class MCDwarfLineAddr {
387388
int64_t LineDelta, uint64_t AddrDelta, raw_ostream &OS);
388389

389390
/// Utility function to encode a Dwarf pair of LineDelta and AddrDeltas using
390-
/// fixed length operands.
391-
static bool FixedEncode(MCContext &Context,
392-
MCDwarfLineTableParams Params,
393-
int64_t LineDelta, uint64_t AddrDelta,
394-
raw_ostream &OS, uint32_t *Offset, uint32_t *Size);
391+
/// fixed length operands. Returns (Offset, Size, SetDelta).
392+
static std::tuple<uint32_t, uint32_t, bool> fixedEncode(MCContext &Context,
393+
int64_t LineDelta,
394+
uint64_t AddrDelta,
395+
raw_ostream &OS);
395396

396397
/// Utility function to emit the encoding to a streamer.
397398
static void Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,

llvm/lib/MC/MCAssembler.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,10 +1119,9 @@ bool MCAssembler::relaxDwarfLineAddr(MCAsmLayout &Layout,
11191119
} else {
11201120
uint32_t Offset;
11211121
uint32_t Size;
1122-
bool SetDelta = MCDwarfLineAddr::FixedEncode(Context,
1123-
getDWARFLinetableParams(),
1124-
LineDelta, AddrDelta,
1125-
OSE, &Offset, &Size);
1122+
bool SetDelta;
1123+
std::tie(Offset, Size, SetDelta) =
1124+
MCDwarfLineAddr::fixedEncode(Context, LineDelta, AddrDelta, OSE);
11261125
// Add Fixups for address delta or new address.
11271126
const MCExpr *FixupExpr;
11281127
if (SetDelta) {

llvm/lib/MC/MCDwarf.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -766,11 +766,10 @@ void MCDwarfLineAddr::Encode(MCContext &Context, MCDwarfLineTableParams Params,
766766
}
767767
}
768768

769-
bool MCDwarfLineAddr::FixedEncode(MCContext &Context,
770-
MCDwarfLineTableParams Params,
771-
int64_t LineDelta, uint64_t AddrDelta,
772-
raw_ostream &OS,
773-
uint32_t *Offset, uint32_t *Size) {
769+
std::tuple<uint32_t, uint32_t, bool>
770+
MCDwarfLineAddr::fixedEncode(MCContext &Context, int64_t LineDelta,
771+
uint64_t AddrDelta, raw_ostream &OS) {
772+
uint32_t Offset, Size;
774773
if (LineDelta != INT64_MAX) {
775774
OS << char(dwarf::DW_LNS_advance_line);
776775
encodeSLEB128(LineDelta, OS);
@@ -790,15 +789,15 @@ bool MCDwarfLineAddr::FixedEncode(MCContext &Context,
790789
encodeULEB128(1 + AddrSize, OS);
791790
OS << char(dwarf::DW_LNE_set_address);
792791
// Generate fixup for the address.
793-
*Offset = OS.tell();
794-
*Size = AddrSize;
792+
Offset = OS.tell();
793+
Size = AddrSize;
795794
SetDelta = false;
796795
OS.write_zeros(AddrSize);
797796
} else {
798797
OS << char(dwarf::DW_LNS_fixed_advance_pc);
799798
// Generate fixup for 2-bytes address delta.
800-
*Offset = OS.tell();
801-
*Size = 2;
799+
Offset = OS.tell();
800+
Size = 2;
802801
SetDelta = true;
803802
OS << char(0);
804803
OS << char(0);
@@ -812,7 +811,7 @@ bool MCDwarfLineAddr::FixedEncode(MCContext &Context,
812811
OS << char(dwarf::DW_LNS_copy);
813812
}
814813

815-
return SetDelta;
814+
return {Offset, Size, SetDelta};
816815
}
817816

818817
// Utility function to write a tuple for .debug_abbrev.

0 commit comments

Comments
 (0)