[llvm] 91cb471 - Initialize fields of TypeRecord subclasses

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 7 15:21:39 PST 2022


Author: Vitaly Buka
Date: 2022-01-07T15:21:22-08:00
New Revision: 91cb471c4bd2db6260c9802c47e9f7344f2b3627

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

LOG: Initialize fields of TypeRecord subclasses

Detected by msan with:
-Xclang -enable-noundef-analysis -mllvm -msan-eager-checks=1

Differential Revision: https://reviews.llvm.org/D116829

Added: 
    

Modified: 
    llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
index 3b6d1b0b1a709..01916bd18fb86 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -111,7 +111,8 @@ class MemberPointerInfo {
   }
 
   TypeIndex ContainingType;
-  PointerToMemberRepresentation Representation;
+  PointerToMemberRepresentation Representation =
+      PointerToMemberRepresentation::Unknown;
 };
 
 class TypeRecord {
@@ -160,8 +161,8 @@ class ProcedureRecord : public TypeRecord {
   TypeIndex getArgumentList() const { return ArgumentList; }
 
   TypeIndex ReturnType;
-  CallingConvention CallConv;
-  FunctionOptions Options;
+  CallingConvention CallConv = CallingConvention::NearC;
+  FunctionOptions Options = FunctionOptions::None;
   uint16_t ParameterCount = 0;
   TypeIndex ArgumentList;
 };
@@ -194,8 +195,8 @@ class MemberFunctionRecord : public TypeRecord {
   TypeIndex ReturnType;
   TypeIndex ClassType;
   TypeIndex ThisType;
-  CallingConvention CallConv;
-  FunctionOptions Options;
+  CallingConvention CallConv = CallingConvention::NearC;
+  FunctionOptions Options = FunctionOptions::None;
   uint16_t ParameterCount = 0;
   TypeIndex ArgumentList;
   int32_t ThisPointerAdjustment = 0;
@@ -209,7 +210,7 @@ class LabelRecord : public TypeRecord {
 
   LabelRecord(LabelType Mode) : TypeRecord(TypeRecordKind::Label), Mode(Mode) {}
 
-  LabelType Mode;
+  LabelType Mode = LabelType::Near;
 };
 
 // LF_MFUNC_ID
@@ -454,7 +455,7 @@ class TagRecord : public TypeRecord {
   StringRef getUniqueName() const { return UniqueName; }
 
   uint16_t MemberCount = 0;
-  ClassOptions Options;
+  ClassOptions Options = ClassOptions::None;
   TypeIndex FieldList;
   StringRef Name;
   StringRef UniqueName;
@@ -585,7 +586,7 @@ class TypeServer2Record : public TypeRecord {
   uint32_t getAge() const { return Age; }
   StringRef getName() const { return Name; }
 
-  GUID Guid;
+  GUID Guid = {};
   uint32_t Age = 0;
   StringRef Name;
 };


        


More information about the llvm-commits mailing list