[llvm] 75e0b58 - [DWARFYAML] Use writeDWARFOffset() to write the prologue_length field. NFC.

Xing GUO via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 21:36:08 PDT 2020


Author: Xing GUO
Date: 2020-08-26T12:34:02+08:00
New Revision: 75e0b5866869ea1feb140d6f718d74c786547113

URL: https://github.com/llvm/llvm-project/commit/75e0b5866869ea1feb140d6f718d74c786547113
DIFF: https://github.com/llvm/llvm-project/commit/75e0b5866869ea1feb140d6f718d74c786547113.diff

LOG: [DWARFYAML] Use writeDWARFOffset() to write the prologue_length field. NFC.

Use writeDWARFOffset() to simplify the logic. NFC.

Added: 
    

Modified: 
    llvm/lib/ObjectYAML/DWARFEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
index ad4b31614b9d..ead629f9a741 100644
--- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -452,10 +452,8 @@ Error DWARFYAML::emitDebugLine(raw_ostream &OS, const DWARFYAML::Data &DI) {
   for (const auto &LineTable : DI.DebugLines) {
     writeInitialLength(LineTable.Format, LineTable.Length, OS,
                        DI.IsLittleEndian);
-    uint64_t SizeOfPrologueLength = LineTable.Format == dwarf::DWARF64 ? 8 : 4;
     writeInteger((uint16_t)LineTable.Version, OS, DI.IsLittleEndian);
-    cantFail(writeVariableSizedInteger(
-        LineTable.PrologueLength, SizeOfPrologueLength, OS, DI.IsLittleEndian));
+    writeDWARFOffset(LineTable.PrologueLength, LineTable.Format, OS, DI.IsLittleEndian);
     writeInteger((uint8_t)LineTable.MinInstLength, OS, DI.IsLittleEndian);
     if (LineTable.Version >= 4)
       writeInteger((uint8_t)LineTable.MaxOpsPerInst, OS, DI.IsLittleEndian);


        


More information about the llvm-commits mailing list