Move get[S|U]LEB128Size() to LEB128.h.

This commit moves getSLEB128Size() and getULEB128Size() from
MCAsmInfo to LEB128.h and removes some copy-and-paste code.

Besides, this commit also adds some unit tests for the LEB128
functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201937 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Logan Chien
2014-02-22 14:00:39 +00:00
parent fb24ccfa32
commit 80668d18e8
10 changed files with 364 additions and 66 deletions

View File

@@ -157,8 +157,7 @@ static inline void EmitDwarfLineTable(MCStreamer *MCOS,
}
if (Discriminator != it->getDiscriminator()) {
Discriminator = it->getDiscriminator();
unsigned Size =
MCOS->getContext().getAsmInfo()->getULEB128Size(Discriminator);
unsigned Size = getULEB128Size(Discriminator);
MCOS->EmitIntValue(dwarf::DW_LNS_extended_op, 1);
MCOS->EmitULEB128IntValue(Size + 1);
MCOS->EmitIntValue(dwarf::DW_LNE_set_discriminator, 1);