Turn two static functions into methods, to simplify calling them.

llvm-svn: 323821
This commit is contained in:
Paul Robinson 2018-01-30 21:39:28 +00:00
parent 9ff714f1c8
commit 2bf8f49d57
2 changed files with 10 additions and 14 deletions

View File

@ -219,6 +219,10 @@ struct MCDwarfLineTableHeader {
std::pair<MCSymbol *, MCSymbol *> std::pair<MCSymbol *, MCSymbol *>
Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params, Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
ArrayRef<char> SpecialOpcodeLengths) const; ArrayRef<char> SpecialOpcodeLengths) const;
private:
void emitV2FileDirTables(MCStreamer *MCOS) const;
void emitV5FileDirTables(MCStreamer *MCOS) const;
}; };
class MCDwarfDwoLineTable { class MCDwarfDwoLineTable {

View File

@ -257,12 +257,9 @@ static void emitAbsValue(MCStreamer &OS, const MCExpr *Value, unsigned Size) {
OS.EmitValue(ABS, Size); OS.EmitValue(ABS, Size);
} }
static void void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
emitV2FileDirTables(MCStreamer *MCOS,
const SmallVectorImpl<std::string> &MCDwarfDirs,
const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles) {
// First the directory table. // First the directory table.
for (auto Dir : MCDwarfDirs) { for (auto &Dir : MCDwarfDirs) {
MCOS->EmitBytes(Dir); // The DirectoryName, and... MCOS->EmitBytes(Dir); // The DirectoryName, and...
MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator. MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator.
} }
@ -280,11 +277,7 @@ emitV2FileDirTables(MCStreamer *MCOS,
MCOS->EmitIntValue(0, 1); // Terminate the file list. MCOS->EmitIntValue(0, 1); // Terminate the file list.
} }
static void void MCDwarfLineTableHeader::emitV5FileDirTables(MCStreamer *MCOS) const {
emitV5FileDirTables(MCStreamer *MCOS,
const SmallVectorImpl<std::string> &MCDwarfDirs,
const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles,
StringRef CompilationDir, bool HasMD5) {
// The directory format, which is just inline null-terminated strings. // The directory format, which is just inline null-terminated strings.
MCOS->EmitIntValue(1, 1); MCOS->EmitIntValue(1, 1);
MCOS->EmitULEB128IntValue(dwarf::DW_LNCT_path); MCOS->EmitULEB128IntValue(dwarf::DW_LNCT_path);
@ -293,7 +286,7 @@ emitV5FileDirTables(MCStreamer *MCOS,
MCOS->EmitULEB128IntValue(MCDwarfDirs.size() + 1); MCOS->EmitULEB128IntValue(MCDwarfDirs.size() + 1);
MCOS->EmitBytes(CompilationDir); MCOS->EmitBytes(CompilationDir);
MCOS->EmitBytes(StringRef("\0", 1)); MCOS->EmitBytes(StringRef("\0", 1));
for (auto Dir : MCDwarfDirs) { for (auto &Dir : MCDwarfDirs) {
MCOS->EmitBytes(Dir); // The DirectoryName, and... MCOS->EmitBytes(Dir); // The DirectoryName, and...
MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator. MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator.
} }
@ -393,10 +386,9 @@ MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
// Put out the directory and file tables. The formats vary depending on // Put out the directory and file tables. The formats vary depending on
// the version. // the version.
if (LineTableVersion >= 5) if (LineTableVersion >= 5)
emitV5FileDirTables(MCOS, MCDwarfDirs, MCDwarfFiles, CompilationDir, emitV5FileDirTables(MCOS);
HasMD5);
else else
emitV2FileDirTables(MCOS, MCDwarfDirs, MCDwarfFiles); emitV2FileDirTables(MCOS);
// This is the end of the prologue, so set the value of the symbol at the // This is the end of the prologue, so set the value of the symbol at the
// end of the prologue (that was used in a previous expression). // end of the prologue (that was used in a previous expression).