[llvm] cf033bb - [DebugInfo][NFC] Zero-initialize a class field

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 19 02:27:03 PDT 2021


Author: Jeremy Morse
Date: 2021-10-19T10:24:12+01:00
New Revision: cf033bb2d39c42818e3f13829b5ac6cc66b0ed6f

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

LOG: [DebugInfo][NFC] Zero-initialize a class field

This field gets assigned when the relevant object starts being used; but it
remains uninitialized beforehand. This risks introducing hard-to-detect
bugs if something changes, so zero-initialize the field.

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index cc0a1d7d65ae..4e59db0245ee 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -574,7 +574,7 @@ class VLocTracker {
   /// much later stage, in the TransferTracker class.
   MapVector<DebugVariable, DbgValue> Vars;
   DenseMap<DebugVariable, const DILocation *> Scopes;
-  MachineBasicBlock *MBB;
+  MachineBasicBlock *MBB = nullptr;
 
 public:
   VLocTracker() {}


        


More information about the llvm-commits mailing list