[llvm] r323821 - Turn two static functions into methods, to simplify calling them.

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 13:39:29 PST 2018


Author: probinson
Date: Tue Jan 30 13:39:28 2018
New Revision: 323821

URL: http://llvm.org/viewvc/llvm-project?rev=323821&view=rev
Log:
Turn two static functions into methods, to simplify calling them.

Modified:
    llvm/trunk/include/llvm/MC/MCDwarf.h
    llvm/trunk/lib/MC/MCDwarf.cpp

Modified: llvm/trunk/include/llvm/MC/MCDwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCDwarf.h?rev=323821&r1=323820&r2=323821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCDwarf.h (original)
+++ llvm/trunk/include/llvm/MC/MCDwarf.h Tue Jan 30 13:39:28 2018
@@ -219,6 +219,10 @@ struct MCDwarfLineTableHeader {
   std::pair<MCSymbol *, MCSymbol *>
   Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
        ArrayRef<char> SpecialOpcodeLengths) const;
+
+private:
+  void emitV2FileDirTables(MCStreamer *MCOS) const;
+  void emitV5FileDirTables(MCStreamer *MCOS) const;
 };
 
 class MCDwarfDwoLineTable {

Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=323821&r1=323820&r2=323821&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Tue Jan 30 13:39:28 2018
@@ -257,12 +257,9 @@ static void emitAbsValue(MCStreamer &OS,
   OS.EmitValue(ABS, Size);
 }
 
-static void
-emitV2FileDirTables(MCStreamer *MCOS,
-                    const SmallVectorImpl<std::string> &MCDwarfDirs,
-                    const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles) {
+void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
   // First the directory table.
-  for (auto Dir : MCDwarfDirs) {
+  for (auto &Dir : MCDwarfDirs) {
     MCOS->EmitBytes(Dir);                // The DirectoryName, and...
     MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator.
   }
@@ -280,11 +277,7 @@ emitV2FileDirTables(MCStreamer *MCOS,
   MCOS->EmitIntValue(0, 1); // Terminate the file list.
 }
 
-static void
-emitV5FileDirTables(MCStreamer *MCOS,
-                    const SmallVectorImpl<std::string> &MCDwarfDirs,
-                    const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles,
-                    StringRef CompilationDir, bool HasMD5) {
+void MCDwarfLineTableHeader::emitV5FileDirTables(MCStreamer *MCOS) const {
   // The directory format, which is just inline null-terminated strings.
   MCOS->EmitIntValue(1, 1);
   MCOS->EmitULEB128IntValue(dwarf::DW_LNCT_path);
@@ -293,7 +286,7 @@ emitV5FileDirTables(MCStreamer *MCOS,
   MCOS->EmitULEB128IntValue(MCDwarfDirs.size() + 1);
   MCOS->EmitBytes(CompilationDir);
   MCOS->EmitBytes(StringRef("\0", 1));
-  for (auto Dir : MCDwarfDirs) {
+  for (auto &Dir : MCDwarfDirs) {
     MCOS->EmitBytes(Dir);                // The DirectoryName, and...
     MCOS->EmitBytes(StringRef("\0", 1)); // its null terminator.
   }
@@ -393,10 +386,9 @@ MCDwarfLineTableHeader::Emit(MCStreamer
   // Put out the directory and file tables.  The formats vary depending on
   // the version.
   if (LineTableVersion >= 5)
-    emitV5FileDirTables(MCOS, MCDwarfDirs, MCDwarfFiles, CompilationDir,
-                        HasMD5);
+    emitV5FileDirTables(MCOS);
   else
-    emitV2FileDirTables(MCOS, MCDwarfDirs, MCDwarfFiles);
+    emitV2FileDirTables(MCOS);
 
   // 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).




More information about the llvm-commits mailing list