Fix uninitialized variable introduced in r207739.
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 1 May 2014 19:55:34 +0000 (19:55 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 1 May 2014 19:55:34 +0000 (19:55 +0000)
This was initialized by llvm-mc (calling setDwarfVersion) but other
clients (such as clang, llc, etc) aren't necessarily initializing this
so we were getting garbage DWARF version values in the output.
Initialize it to a reasonable default (the same default used in llvm-mc,
though this is higher than it was (2) previously).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207788 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCContext.cpp

index 601903a17312f24fdc67bcf048ded702ce28ee94..c16326829d8aa27b0ab214f5b08edc070156bfa0 100644 (file)
@@ -35,7 +35,7 @@ MCContext::MCContext(const MCAsmInfo *mai, const MCRegisterInfo *mri,
     : SrcMgr(mgr), MAI(mai), MRI(mri), MOFI(mofi), Allocator(),
       Symbols(Allocator), UsedNames(Allocator), NextUniqueID(0),
       CurrentDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT, 0, 0), DwarfLocSeen(false),
-      GenDwarfForAssembly(false), GenDwarfFileNumber(0),
+      GenDwarfForAssembly(false), GenDwarfFileNumber(0), DwarfVersion(4),
       AllowTemporaryLabels(true), DwarfCompileUnitID(0),
       AutoReset(DoAutoReset) {