[llvm] 548553e - [DWARF] Simplify DWARFExpression. NFC.

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 04:23:46 PST 2020


Author: Igor Kudrin
Date: 2020-01-27T19:08:46+07:00
New Revision: 548553eac7b5c9fafd63c56b0304f35c911dd9fc

URL: https://github.com/llvm/llvm-project/commit/548553eac7b5c9fafd63c56b0304f35c911dd9fc
DIFF: https://github.com/llvm/llvm-project/commit/548553eac7b5c9fafd63c56b0304f35c911dd9fc.diff

LOG: [DWARF] Simplify DWARFExpression. NFC.

As DataExtractor already has a method to extract an unsigned value of
a specified size, there is no need to duplicate that.

Differential Revision: https://reviews.llvm.org/D73263

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
index 7d817d8a9925..6f28aa46328c 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
@@ -157,14 +157,7 @@ bool DWARFExpression::Operation::extract(DataExtractor Data, uint16_t Version,
       Operands[Operand] = Data.getU64(&Offset);
       break;
     case Operation::SizeAddr:
-      if (AddressSize == 8) {
-        Operands[Operand] = Data.getU64(&Offset);
-      } else if (AddressSize == 4) {
-        Operands[Operand] = Data.getU32(&Offset);
-      } else {
-        assert(AddressSize == 2);
-        Operands[Operand] = Data.getU16(&Offset);
-      }
+      Operands[Operand] = Data.getUnsigned(&Offset, AddressSize);
       break;
     case Operation::SizeRefAddr:
       if (getRefAddrSize(AddressSize, Version) == 8) {


        


More information about the llvm-commits mailing list