[PATCH] D95657: [NFC][DebugInfo] Fix Wreturn-type gcc warning

Yang Fan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 18:45:44 PST 2021


nullptr.cpp created this revision.
Herald added a subscriber: hiraditya.
nullptr.cpp requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

GCC warning:

  /llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp: In member function ‘llvm::Expected<long unsigned int> llvm::dwarf::CFIProgram::Instruction::getOperandAsUnsigned(const llvm::dwarf::CFIProgram&, uint32_t) const’:
  /llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp:425:1: warning: control reaches end of non-void function [-Wreturn-type]
    425 | }
        | ^
  /llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp: In member function ‘llvm::Expected<long int> llvm::dwarf::CFIProgram::Instruction::getOperandAsSigned(const llvm::dwarf::CFIProgram&, uint32_t) const’:
  /llvm-project/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp:477:1: warning: control reaches end of non-void function [-Wreturn-type]
    477 | }
        | ^


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95657

Files:
  llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp


Index: llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
@@ -422,6 +422,7 @@
     return Operand * CodeAlignmentFactor;
   }
   }
+  llvm_unreachable("invalid operand type");
 }
 
 llvm::Expected<int64_t>
@@ -474,6 +475,7 @@
     return Operand * DataAlignmentFactor;
   }
   }
+  llvm_unreachable("invalid operand type");
 }
 
 Error UnwindTable::parseRows(const CFIProgram &CFIP, UnwindRow &Row,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95657.320023.patch
Type: text/x-patch
Size: 559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210129/fbb971af/attachment.bin>


More information about the llvm-commits mailing list