From 697477e00c3fc08795efb81f002fbf4ad3c055d1 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Thu, 19 Nov 2015 00:51:50 +0000 Subject: [PATCH] Fix UMR in llvm-nm on IR object files in printDarwinSymbol git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253529 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-nm/llvm-nm.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index 4144d538c1a..b812233034e 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -239,9 +239,8 @@ static void darwinPrintSymbol(SymbolicFile &Obj, SymbolListT::iterator I, const char *printDashes, const char *printFormat) { MachO::mach_header H; MachO::mach_header_64 H_64; - uint32_t Filetype, Flags; - MachO::nlist_64 STE_64; - MachO::nlist STE; + uint32_t Filetype = MachO::MH_OBJECT; + uint32_t Flags = 0; uint8_t NType = 0; uint8_t NSect = 0; uint16_t NDesc = 0; @@ -280,7 +279,7 @@ static void darwinPrintSymbol(SymbolicFile &Obj, SymbolListT::iterator I, H_64 = MachO->MachOObjectFile::getHeader64(); Filetype = H_64.filetype; Flags = H_64.flags; - STE_64 = MachO->getSymbol64TableEntry(SymDRI); + MachO::nlist_64 STE_64 = MachO->getSymbol64TableEntry(SymDRI); NType = STE_64.n_type; NSect = STE_64.n_sect; NDesc = STE_64.n_desc; @@ -290,7 +289,7 @@ static void darwinPrintSymbol(SymbolicFile &Obj, SymbolListT::iterator I, H = MachO->MachOObjectFile::getHeader(); Filetype = H.filetype; Flags = H.flags; - STE = MachO->getSymbolTableEntry(SymDRI); + MachO::nlist STE = MachO->getSymbolTableEntry(SymDRI); NType = STE.n_type; NSect = STE.n_sect; NDesc = STE.n_desc; -- 2.34.1