[llvm] e5f258c - [NFC][DebugInfo] Fix Wreturn-type gcc warning

Yang Fan via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 19:43:06 PST 2021


Author: Yang Fan
Date: 2021-01-29T11:42:23+08:00
New Revision: e5f258cb03f249601222496e6bb350fe2cc3431e

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

LOG: [NFC][DebugInfo] Fix Wreturn-type gcc warning

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 | }
      | ^
```

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
index d95cbb70225e..3ff1c0700dd7 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
@@ -422,6 +422,7 @@ CFIProgram::Instruction::getOperandAsUnsigned(const CFIProgram &CFIP,
     return Operand * CodeAlignmentFactor;
   }
   }
+  llvm_unreachable("invalid operand type");
 }
 
 llvm::Expected<int64_t>
@@ -474,6 +475,7 @@ CFIProgram::Instruction::getOperandAsSigned(const CFIProgram &CFIP,
     return Operand * DataAlignmentFactor;
   }
   }
+  llvm_unreachable("invalid operand type");
 }
 
 Error UnwindTable::parseRows(const CFIProgram &CFIP, UnwindRow &Row,


        


More information about the llvm-commits mailing list