[SymbolFileNativePDB] Fix compilation errors with gcc.
authorZachary Turner <zturner@google.com>
Wed, 10 Oct 2018 18:52:37 +0000 (18:52 +0000)
committerZachary Turner <zturner@google.com>
Wed, 10 Oct 2018 18:52:37 +0000 (18:52 +0000)
llvm-svn: 344173

lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

index 4a7bbea..c9bd9a4 100644 (file)
@@ -134,14 +134,15 @@ void PdbIndex::BuildAddrToSymbolMap(CompilandIndexItem &cci) {
     // If the debug info is incorrect, we could have multiple symbols with the
     // same address.  So use try_emplace instead of insert, and the first one
     // will win.
-    auto emplace_result = cci.m_symbols_by_va.try_emplace(va, cu_sym_uid);
-    (void)emplace_result;
+    auto insert_result =
+        cci.m_symbols_by_va.insert(std::make_pair(va, cu_sym_uid));
+    (void)insert_result;
 
     // The odds of an error in some function such as GetSegmentAndOffset or
     // MakeVirtualAddress are much higher than the odds of encountering bad
     // debug info, so assert that this item was inserted in the map as opposed
     // to having already been there.
-    lldbassert(emplace_result.second);
+    lldbassert(insert_result.second);
   }
 }
 
index ac86f6d..55de966 100644 (file)
@@ -219,14 +219,14 @@ GetSegmentOffsetAndLength<TrampolineSym>(const CVSymbol &sym) {
 template <>
 SegmentOffsetLength GetSegmentOffsetAndLength<Thunk32Sym>(const CVSymbol &sym) {
   Thunk32Sym record = createRecord<Thunk32Sym>(sym);
-  return {record.Segment, record.Offset, record.Length};
+  return SegmentOffsetLength{record.Segment, record.Offset, record.Length};
 }
 
 template <>
 SegmentOffsetLength
 GetSegmentOffsetAndLength<CoffGroupSym>(const CVSymbol &sym) {
   CoffGroupSym record = createRecord<CoffGroupSym>(sym);
-  return {record.Segment, record.Offset, record.Size};
+  return SegmentOffsetLength{record.Segment, record.Offset, record.Size};
 }
 
 SegmentOffsetLength lldb_private::npdb::GetSegmentOffsetAndLength(
index 8f71d06..61b1649 100644 (file)
@@ -20,11 +20,16 @@ namespace lldb_private {
 namespace npdb {
 
 struct SegmentOffset {
+  SegmentOffset() = default;
+  SegmentOffset(uint16_t s, uint32_t o) : segment(s), offset(o) {}
   uint16_t segment = 0;
   uint32_t offset = 0;
 };
 
 struct SegmentOffsetLength {
+  SegmentOffsetLength() = default;
+  SegmentOffsetLength(uint16_t s, uint32_t o, uint32_t l)
+      : so(s, o), length(l) {}
   SegmentOffset so;
   uint32_t length = 0;
 };
index 7bc9c7a..568f706 100644 (file)
@@ -487,7 +487,6 @@ bool SymbolFileNativePDB::ParseCompileUnitLineTable(
       }
 
       // LLDB wants the index of the file in the list of support files.
-      llvm::StringRef file_name = *efn;
       auto fn_iter = llvm::find(cci->m_file_list, *efn);
       lldbassert(fn_iter != cci->m_file_list.end());
       uint32_t file_index = std::distance(cci->m_file_list.begin(), fn_iter);