diff options
Diffstat (limited to 'lib/DebugInfo/PDB/Native')
| -rw-r--r-- | lib/DebugInfo/PDB/Native/DbiModuleList.cpp | 11 | ||||
| -rw-r--r-- | lib/DebugInfo/PDB/Native/Hash.cpp | 2 | ||||
| -rw-r--r-- | lib/DebugInfo/PDB/Native/HashTable.cpp | 16 | ||||
| -rw-r--r-- | lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp | 6 | ||||
| -rw-r--r-- | lib/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.cpp | 0 | ||||
| -rw-r--r-- | lib/DebugInfo/PDB/Native/NamedStreamMap.cpp | 9 | ||||
| -rw-r--r-- | lib/DebugInfo/PDB/Native/NativeEnumModules.cpp | 4 | ||||
| -rw-r--r-- | lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp | 29 | ||||
| -rw-r--r-- | lib/DebugInfo/PDB/Native/NativeSession.cpp | 21 | 
9 files changed, 60 insertions, 38 deletions
| diff --git a/lib/DebugInfo/PDB/Native/DbiModuleList.cpp b/lib/DebugInfo/PDB/Native/DbiModuleList.cpp index 434f775097e0..eea70b229c67 100644 --- a/lib/DebugInfo/PDB/Native/DbiModuleList.cpp +++ b/lib/DebugInfo/PDB/Native/DbiModuleList.cpp @@ -1,4 +1,4 @@ -//===- DbiModuleList.cpp - PDB module information list ----------*- C++ -*-===// +//===- DbiModuleList.cpp - PDB module information list --------------------===//  //  //                     The LLVM Compiler Infrastructure  // @@ -6,10 +6,17 @@  // License. See LICENSE.TXT for details.  //  //===----------------------------------------------------------------------===// -#include "llvm/DebugInfo/PDB/Native/DbiModuleList.h" +#include "llvm/DebugInfo/PDB/Native/DbiModuleList.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/iterator_range.h"  #include "llvm/DebugInfo/PDB/Native/RawError.h" +#include "llvm/Support/BinaryStreamReader.h"  #include "llvm/Support/Error.h" +#include <algorithm> +#include <cassert> +#include <cstddef> +#include <cstdint>  using namespace llvm;  using namespace llvm::pdb; diff --git a/lib/DebugInfo/PDB/Native/Hash.cpp b/lib/DebugInfo/PDB/Native/Hash.cpp index 2ad3f55dc5c3..61188ece2dcb 100644 --- a/lib/DebugInfo/PDB/Native/Hash.cpp +++ b/lib/DebugInfo/PDB/Native/Hash.cpp @@ -8,10 +8,10 @@  //===----------------------------------------------------------------------===//  #include "llvm/DebugInfo/PDB/Native/Hash.h" -  #include "llvm/ADT/ArrayRef.h"  #include "llvm/Support/Endian.h"  #include "llvm/Support/JamCRC.h" +#include <cstdint>  using namespace llvm;  using namespace llvm::support; diff --git a/lib/DebugInfo/PDB/Native/HashTable.cpp b/lib/DebugInfo/PDB/Native/HashTable.cpp index ebf8c9c04db1..439217f91d04 100644 --- a/lib/DebugInfo/PDB/Native/HashTable.cpp +++ b/lib/DebugInfo/PDB/Native/HashTable.cpp @@ -1,4 +1,4 @@ -//===- HashTable.cpp - PDB Hash Table ---------------------------*- C++ -*-===// +//===- HashTable.cpp - PDB Hash Table -------------------------------------===//  //  //                     The LLVM Compiler Infrastructure  // @@ -8,12 +8,16 @@  //===----------------------------------------------------------------------===//  #include "llvm/DebugInfo/PDB/Native/HashTable.h" -  #include "llvm/ADT/Optional.h" -#include "llvm/ADT/SparseBitVector.h"  #include "llvm/DebugInfo/PDB/Native/RawError.h" - -#include <assert.h> +#include "llvm/Support/BinaryStreamReader.h" +#include "llvm/Support/BinaryStreamWriter.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/MathExtras.h" +#include <algorithm> +#include <cassert> +#include <cstdint> +#include <utility>  using namespace llvm;  using namespace llvm::pdb; @@ -106,9 +110,11 @@ void HashTable::clear() {  }  uint32_t HashTable::capacity() const { return Buckets.size(); } +  uint32_t HashTable::size() const { return Present.count(); }  HashTableIterator HashTable::begin() const { return HashTableIterator(*this); } +  HashTableIterator HashTable::end() const {    return HashTableIterator(*this, 0, true);  } diff --git a/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp b/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp index 83c56574a16e..2e1f61c7a25d 100644 --- a/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp +++ b/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp @@ -9,11 +9,11 @@  #include "llvm/DebugInfo/PDB/Native/ModuleDebugStream.h"  #include "llvm/ADT/iterator_range.h" +#include "llvm/DebugInfo/CodeView/CodeView.h" +#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"  #include "llvm/DebugInfo/CodeView/SymbolRecord.h"  #include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h" -#include "llvm/DebugInfo/PDB/Native/PDBFile.h"  #include "llvm/DebugInfo/PDB/Native/RawError.h" -#include "llvm/DebugInfo/PDB/Native/RawTypes.h"  #include "llvm/Support/BinaryStreamReader.h"  #include "llvm/Support/BinaryStreamRef.h"  #include "llvm/Support/Error.h" @@ -97,7 +97,7 @@ ModuleDebugStreamRef::symbols(bool *HadError) const {    return make_range(SymbolArray.begin(HadError), SymbolArray.end());  } -llvm::iterator_range<ModuleDebugStreamRef::DebugSubsectionIterator> +iterator_range<ModuleDebugStreamRef::DebugSubsectionIterator>  ModuleDebugStreamRef::subsections() const {    return make_range(Subsections.begin(), Subsections.end());  } diff --git a/lib/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.cpp b/lib/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.cpp deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/lib/DebugInfo/PDB/Native/ModuleDebugStreamBuilder.cpp +++ /dev/null diff --git a/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp b/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp index 4f90cd9cd8ac..354b8c0e07ff 100644 --- a/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp +++ b/lib/DebugInfo/PDB/Native/NamedStreamMap.cpp @@ -1,4 +1,4 @@ -//===- NamedStreamMap.cpp - PDB Named Stream Map ----------------*- C++ -*-===// +//===- NamedStreamMap.cpp - PDB Named Stream Map --------------------------===//  //  //                     The LLVM Compiler Infrastructure  // @@ -8,17 +8,20 @@  //===----------------------------------------------------------------------===//  #include "llvm/DebugInfo/PDB/Native/NamedStreamMap.h" - -#include "llvm/ADT/SparseBitVector.h"  #include "llvm/ADT/StringMap.h"  #include "llvm/ADT/StringRef.h"  #include "llvm/ADT/iterator_range.h"  #include "llvm/DebugInfo/PDB/Native/HashTable.h"  #include "llvm/DebugInfo/PDB/Native/RawError.h"  #include "llvm/Support/BinaryStreamReader.h" +#include "llvm/Support/BinaryStreamRef.h" +#include "llvm/Support/BinaryStreamWriter.h" +#include "llvm/Support/Endian.h"  #include "llvm/Support/Error.h"  #include <algorithm> +#include <cassert>  #include <cstdint> +#include <tuple>  using namespace llvm;  using namespace llvm::pdb; diff --git a/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp b/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp index c23120041164..a65782e2d4fc 100644 --- a/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp +++ b/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp @@ -32,9 +32,7 @@ std::unique_ptr<PDBSymbol>  NativeEnumModules::getChildAtIndex(uint32_t Index) const {    if (Index >= Modules.getModuleCount())      return nullptr; -  return std::unique_ptr<PDBSymbol>(new PDBSymbolCompiland( -      Session, std::unique_ptr<IPDBRawSymbol>(new NativeCompilandSymbol( -                   Session, 0, Modules.getModuleDescriptor(Index))))); +  return Session.createCompilandSymbol(Modules.getModuleDescriptor(Index));  }  std::unique_ptr<PDBSymbol> NativeEnumModules::getNext() { diff --git a/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp b/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp index ed6db63edbab..b4f5c96ce66b 100644 --- a/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp +++ b/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp @@ -1,4 +1,4 @@ -//===- NativeRawSymbol.cpp - Native implementation of IPDBRawSymbol -*- C++ -*-===// +//===- NativeRawSymbol.cpp - Native implementation of IPDBRawSymbol -------===//  //  //                     The LLVM Compiler Infrastructure  // @@ -8,16 +8,7 @@  //===----------------------------------------------------------------------===//  #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h" -#include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" -#include "llvm/DebugInfo/PDB/Native/NativeSession.h" -#include "llvm/DebugInfo/PDB/PDBExtras.h"  #include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h" -#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h" -#include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h" -#include "llvm/Support/ConvertUTF.h" -#include "llvm/Support/raw_ostream.h"  using namespace llvm;  using namespace llvm::pdb; @@ -49,7 +40,7 @@ NativeRawSymbol::findInlineFramesByRVA(uint32_t RVA) const {    return nullptr;  } -void NativeRawSymbol::getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) const { +void NativeRawSymbol::getDataBytes(SmallVector<uint8_t, 32> &bytes) const {    bytes.clear();  } @@ -109,7 +100,7 @@ uint32_t NativeRawSymbol::getClassParentId() const {  }  std::string NativeRawSymbol::getCompilerName() const { -  return 0; +  return {};  }  uint32_t NativeRawSymbol::getCount() const { @@ -136,7 +127,7 @@ uint32_t NativeRawSymbol::getLexicalParentId() const {  }  std::string NativeRawSymbol::getLibraryName() const { -  return ""; +  return {};  }  uint32_t NativeRawSymbol::getLiveRangeStartAddressOffset() const { @@ -164,7 +155,7 @@ uint32_t NativeRawSymbol::getMemorySpaceKind() const {  }  std::string NativeRawSymbol::getName() const { -  return 0; +  return {};  }  uint32_t NativeRawSymbol::getNumberOfAcceleratorPointerTags() const { @@ -188,7 +179,7 @@ uint32_t NativeRawSymbol::getNumberOfRows() const {  }  std::string NativeRawSymbol::getObjectFileName() const { -  return ""; +  return {};  }  uint32_t NativeRawSymbol::getOemId() const { @@ -240,7 +231,7 @@ uint32_t NativeRawSymbol::getSlot() const {  }  std::string NativeRawSymbol::getSourceFileName() const { -  return 0; +  return {};  }  uint32_t NativeRawSymbol::getStride() const { @@ -251,7 +242,7 @@ uint32_t NativeRawSymbol::getSubTypeId() const {    return 0;  } -std::string NativeRawSymbol::getSymbolsFileName() const { return ""; } +std::string NativeRawSymbol::getSymbolsFileName() const { return {}; }  uint32_t NativeRawSymbol::getSymIndexId() const { return SymbolId; } @@ -292,7 +283,7 @@ uint32_t NativeRawSymbol::getUavSlot() const {  }  std::string NativeRawSymbol::getUndecoratedName() const { -  return 0; +  return {};  }  uint32_t NativeRawSymbol::getUnmodifiedTypeId() const { @@ -701,5 +692,5 @@ bool NativeRawSymbol::wasInlined() const {  }  std::string NativeRawSymbol::getUnused() const { -  return ""; +  return {};  } diff --git a/lib/DebugInfo/PDB/Native/NativeSession.cpp b/lib/DebugInfo/PDB/Native/NativeSession.cpp index 3ab381e76e62..93d43d9ef341 100644 --- a/lib/DebugInfo/PDB/Native/NativeSession.cpp +++ b/lib/DebugInfo/PDB/Native/NativeSession.cpp @@ -13,6 +13,7 @@  #include "llvm/DebugInfo/PDB/GenericError.h"  #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"  #include "llvm/DebugInfo/PDB/IPDBSourceFile.h" +#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"  #include "llvm/DebugInfo/PDB/Native/NativeExeSymbol.h"  #include "llvm/DebugInfo/PDB/Native/PDBFile.h"  #include "llvm/DebugInfo/PDB/Native/RawError.h" @@ -23,8 +24,10 @@  #include "llvm/Support/Error.h"  #include "llvm/Support/ErrorOr.h"  #include "llvm/Support/MemoryBuffer.h" +  #include <algorithm>  #include <memory> +#include <utility>  using namespace llvm;  using namespace llvm::msf; @@ -66,12 +69,23 @@ Error NativeSession::createFromExe(StringRef Path,    return make_error<RawError>(raw_error_code::feature_unsupported);  } +std::unique_ptr<PDBSymbolCompiland> +NativeSession::createCompilandSymbol(DbiModuleDescriptor MI) { +  const auto Id = static_cast<uint32_t>(SymbolCache.size()); +  SymbolCache.push_back( +      llvm::make_unique<NativeCompilandSymbol>(*this, Id, MI)); +  return llvm::make_unique<PDBSymbolCompiland>( +      *this, std::unique_ptr<IPDBRawSymbol>(SymbolCache[Id]->clone())); +} +  uint64_t NativeSession::getLoadAddress() const { return 0; }  void NativeSession::setLoadAddress(uint64_t Address) {}  std::unique_ptr<PDBSymbolExe> NativeSession::getGlobalScope() { -  auto RawSymbol = llvm::make_unique<NativeExeSymbol>(*this, 0); +  const auto Id = static_cast<uint32_t>(SymbolCache.size()); +  SymbolCache.push_back(llvm::make_unique<NativeExeSymbol>(*this, Id)); +  auto RawSymbol = SymbolCache[Id]->clone();    auto PdbSymbol(PDBSymbol::create(*this, std::move(RawSymbol)));    std::unique_ptr<PDBSymbolExe> ExeSymbol(        static_cast<PDBSymbolExe *>(PdbSymbol.release())); @@ -80,7 +94,10 @@ std::unique_ptr<PDBSymbolExe> NativeSession::getGlobalScope() {  std::unique_ptr<PDBSymbol>  NativeSession::getSymbolById(uint32_t SymbolId) const { -  return nullptr; +  // If the caller has a SymbolId, it'd better be in our SymbolCache. +  return SymbolId < SymbolCache.size() +             ? PDBSymbol::create(*this, SymbolCache[SymbolId]->clone()) +             : nullptr;  }  std::unique_ptr<PDBSymbol> | 
