[PATCH] D19083: [clang-analyzer] fix warnings emitted on llvm code base

Apelete Seketeli via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 05:21:32 PDT 2016


apelete updated this revision to Diff 56269.
apelete added a comment.
Herald added a subscriber: MatzeB.

[scan-build] fix warnings emitted on LLVM CodeGen code base

Changes since last revision:

- split patch into CodeGen changes unit to ease review process,
- cherry-pick CodeGen changes from http://reviews.llvm.org/D19498.


http://reviews.llvm.org/D19083

Files:
  lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  lib/CodeGen/ScheduleDAGInstrs.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -6465,6 +6465,9 @@
   // assign it now.
   if (unsigned AssignedReg = PhysReg.first) {
     const TargetRegisterClass *RC = PhysReg.second;
+
+    assert(RC && "TargetRegisterClass needs to be not NULL");
+
     if (OpInfo.ConstraintVT == MVT::Other)
       ValueVT = *RC->vt_begin();
 
Index: lib/CodeGen/ScheduleDAGInstrs.cpp
===================================================================
--- lib/CodeGen/ScheduleDAGInstrs.cpp
+++ lib/CodeGen/ScheduleDAGInstrs.cpp
@@ -914,7 +914,8 @@
   for (MachineBasicBlock::iterator MII = RegionEnd, MIE = RegionBegin;
        MII != MIE; --MII) {
     MachineInstr *MI = std::prev(MII);
-    if (MI && DbgMI) {
+
+    if (DbgMI) {
       DbgValues.push_back(std::make_pair(DbgMI, MI));
       DbgMI = nullptr;
     }
Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -463,6 +463,9 @@
       varField = DT;
   }
 
+  assert(forwardingField && "forwarding field must not be NULL");
+  assert(varField && "var field must not be NULL");
+
   // Get the offsets for the forwarding field and the variable field.
   unsigned forwardingFieldOffset = forwardingField->getOffsetInBits() >> 3;
   unsigned varFieldOffset = varField->getOffsetInBits() >> 2;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19083.56269.patch
Type: text/x-patch
Size: 1572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160505/65670739/attachment.bin>


More information about the llvm-commits mailing list