[libunwind] r321448 - [libunwind] Remove dubious template function. NFC.

whitequark via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 25 13:08:41 PST 2017


Author: whitequark
Date: Mon Dec 25 13:08:41 2017
New Revision: 321448

URL: http://llvm.org/viewvc/llvm-project?rev=321448&view=rev
Log:
[libunwind] Remove dubious template function. NFC.

Per review by Don Hinton.

Modified:
    libunwind/trunk/src/DwarfParser.hpp

Modified: libunwind/trunk/src/DwarfParser.hpp
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfParser.hpp?rev=321448&r1=321447&r2=321448&view=diff
==============================================================================
--- libunwind/trunk/src/DwarfParser.hpp (original)
+++ libunwind/trunk/src/DwarfParser.hpp Mon Dec 25 13:08:41 2017
@@ -25,10 +25,6 @@
 
 namespace libunwind {
 
-// Avoid relying on C++ headers.
-template <class T>
-static constexpr T pint_max_value() { return ~0; }
-
 /// CFI_Parser does basic parsing of a CFI (Call Frame Information) records.
 /// See DWARF Spec for details:
 ///    http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
@@ -543,7 +539,7 @@ bool CFI_Parser<A>::parseInstructions(A
       results->cfaRegister = 0;
       results->cfaExpression = (int64_t)p;
       length = addressSpace.getULEB128(p, instructionsEnd);
-      assert(length < pint_max_value<pint_t>() && "pointer overflow");
+      assert(length < static_cast<pint_t>(~0) && "pointer overflow");
       p += static_cast<pint_t>(length);
       _LIBUNWIND_TRACE_DWARF("DW_CFA_def_cfa_expression(expression=0x%" PRIx64
                              ", length=%" PRIu64 ")\n",
@@ -559,7 +555,7 @@ bool CFI_Parser<A>::parseInstructions(A
       results->savedRegisters[reg].location = kRegisterAtExpression;
       results->savedRegisters[reg].value = (int64_t)p;
       length = addressSpace.getULEB128(p, instructionsEnd);
-      assert(length < pint_max_value<pint_t>() && "pointer overflow");
+      assert(length < static_cast<pint_t>(~0) && "pointer overflow");
       p += static_cast<pint_t>(length);
       _LIBUNWIND_TRACE_DWARF("DW_CFA_expression(reg=%" PRIu64 ", "
                              "expression=0x%" PRIx64 ", "
@@ -645,7 +641,7 @@ bool CFI_Parser<A>::parseInstructions(A
       results->savedRegisters[reg].location = kRegisterIsExpression;
       results->savedRegisters[reg].value = (int64_t)p;
       length = addressSpace.getULEB128(p, instructionsEnd);
-      assert(length < pint_max_value<pint_t>() && "pointer overflow");
+      assert(length < static_cast<pint_t>(~0) && "pointer overflow");
       p += static_cast<pint_t>(length);
       _LIBUNWIND_TRACE_DWARF("DW_CFA_val_expression(reg=%" PRIu64 ", "
                              "expression=0x%" PRIx64 ", length=%" PRIu64 ")\n",




More information about the cfe-commits mailing list