diff options
Diffstat (limited to 'lib/DebugInfo/PDB')
21 files changed, 110 insertions, 121 deletions
diff --git a/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp b/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp index a8ae076e1d6c..c2552f55703c 100644 --- a/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp +++ b/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp @@ -405,7 +405,7 @@ DIARawSymbol::findChildren(PDB_SymType Type) const { return nullptr; } - return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); + return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); } std::unique_ptr<IPDBEnumSymbols> @@ -423,7 +423,7 @@ DIARawSymbol::findChildren(PDB_SymType Type, StringRef Name, Symbol->findChildrenEx(EnumVal, Name16Str, CompareFlags, &DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); + return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); } std::unique_ptr<IPDBEnumSymbols> @@ -443,7 +443,7 @@ DIARawSymbol::findChildrenByAddr(PDB_SymType Type, StringRef Name, Section, Offset, &DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); + return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); } std::unique_ptr<IPDBEnumSymbols> @@ -462,7 +462,7 @@ DIARawSymbol::findChildrenByVA(PDB_SymType Type, StringRef Name, &DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); + return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); } std::unique_ptr<IPDBEnumSymbols> @@ -480,7 +480,7 @@ DIARawSymbol::findChildrenByRVA(PDB_SymType Type, StringRef Name, &DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); + return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); } std::unique_ptr<IPDBEnumSymbols> @@ -489,7 +489,7 @@ DIARawSymbol::findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const { if (S_OK != Symbol->findInlineFramesByAddr(Section, Offset, &DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); + return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); } std::unique_ptr<IPDBEnumSymbols> @@ -498,7 +498,7 @@ DIARawSymbol::findInlineFramesByRVA(uint32_t RVA) const { if (S_OK != Symbol->findInlineFramesByRVA(RVA, &DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); + return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); } std::unique_ptr<IPDBEnumSymbols> @@ -507,7 +507,7 @@ DIARawSymbol::findInlineFramesByVA(uint64_t VA) const { if (S_OK != Symbol->findInlineFramesByVA(VA, &DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); + return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator); } std::unique_ptr<IPDBEnumLineNumbers> DIARawSymbol::findInlineeLines() const { @@ -515,7 +515,7 @@ std::unique_ptr<IPDBEnumLineNumbers> DIARawSymbol::findInlineeLines() const { if (S_OK != Symbol->findInlineeLines(&DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator); + return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator); } std::unique_ptr<IPDBEnumLineNumbers> @@ -526,7 +526,7 @@ DIARawSymbol::findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, Symbol->findInlineeLinesByAddr(Section, Offset, Length, &DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator); + return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator); } std::unique_ptr<IPDBEnumLineNumbers> @@ -535,7 +535,7 @@ DIARawSymbol::findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const { if (S_OK != Symbol->findInlineeLinesByRVA(RVA, Length, &DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator); + return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator); } std::unique_ptr<IPDBEnumLineNumbers> @@ -544,7 +544,7 @@ DIARawSymbol::findInlineeLinesByVA(uint64_t VA, uint32_t Length) const { if (S_OK != Symbol->findInlineeLinesByVA(VA, Length, &DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator); + return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator); } void DIARawSymbol::getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) const { @@ -776,7 +776,7 @@ std::unique_ptr<IPDBLineNumber> DIARawSymbol::getSrcLineOnTypeDefn() const { if (FAILED(Symbol->getSrcLineOnTypeDefn(&LineNumber)) || !LineNumber) return nullptr; - return llvm::make_unique<DIALineNumber>(LineNumber); + return std::make_unique<DIALineNumber>(LineNumber); } uint32_t DIARawSymbol::getStride() const { @@ -871,7 +871,7 @@ DIARawSymbol::getVirtualBaseTableType() const { if (FAILED(Symbol->get_virtualBaseTableType(&TableType)) || !TableType) return nullptr; - auto RawVT = llvm::make_unique<DIARawSymbol>(Session, TableType); + auto RawVT = std::make_unique<DIARawSymbol>(Session, TableType); auto Pointer = PDBSymbol::createAs<PDBSymbolTypePointer>(Session, std::move(RawVT)); return unique_dyn_cast<PDBSymbolTypeBuiltin>(Pointer->getPointeeType()); diff --git a/lib/DebugInfo/PDB/DIA/DIASectionContrib.cpp b/lib/DebugInfo/PDB/DIA/DIASectionContrib.cpp index e2d928f2c4b2..4f0e078e6712 100644 --- a/lib/DebugInfo/PDB/DIA/DIASectionContrib.cpp +++ b/lib/DebugInfo/PDB/DIA/DIASectionContrib.cpp @@ -23,7 +23,7 @@ std::unique_ptr<PDBSymbolCompiland> DIASectionContrib::getCompiland() const { if (FAILED(Section->get_compiland(&Symbol))) return nullptr; - auto RawSymbol = llvm::make_unique<DIARawSymbol>(Session, Symbol); + auto RawSymbol = std::make_unique<DIARawSymbol>(Session, Symbol); return PDBSymbol::createAs<PDBSymbolCompiland>(Session, std::move(RawSymbol)); } diff --git a/lib/DebugInfo/PDB/DIA/DIASession.cpp b/lib/DebugInfo/PDB/DIA/DIASession.cpp index 4e0b8587c613..64ffa776bbd6 100644 --- a/lib/DebugInfo/PDB/DIA/DIASession.cpp +++ b/lib/DebugInfo/PDB/DIA/DIASession.cpp @@ -73,15 +73,7 @@ static Error LoadDIA(CComPtr<IDiaDataSource> &DiaDataSource) { #if !defined(_MSC_VER) return llvm::make_error<PDBError>(pdb_error_code::dia_failed_loading); #else - const wchar_t *msdia_dll = nullptr; -#if _MSC_VER >= 1900 && _MSC_VER < 2000 - msdia_dll = L"msdia140.dll"; // VS2015 -#elif _MSC_VER >= 1800 - msdia_dll = L"msdia120.dll"; // VS2013 -#else -#error "Unknown Visual Studio version." -#endif - + const wchar_t *msdia_dll = L"msdia140.dll"; HRESULT HR; if (FAILED(HR = NoRegCoCreate(msdia_dll, CLSID_DiaSource, IID_IDiaDataSource, reinterpret_cast<LPVOID *>(&DiaDataSource)))) @@ -158,7 +150,7 @@ std::unique_ptr<PDBSymbolExe> DIASession::getGlobalScope() { if (S_OK != Session->get_globalScope(&GlobalScope)) return nullptr; - auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, GlobalScope); + auto RawSymbol = std::make_unique<DIARawSymbol>(*this, GlobalScope); auto PdbSymbol(PDBSymbol::create(*this, std::move(RawSymbol))); std::unique_ptr<PDBSymbolExe> ExeSymbol( static_cast<PDBSymbolExe *>(PdbSymbol.release())); @@ -193,7 +185,7 @@ DIASession::getSymbolById(SymIndexId SymbolId) const { if (S_OK != Session->symbolById(SymbolId, &LocatedSymbol)) return nullptr; - auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, LocatedSymbol); + auto RawSymbol = std::make_unique<DIARawSymbol>(*this, LocatedSymbol); return PDBSymbol::create(*this, std::move(RawSymbol)); } @@ -210,7 +202,7 @@ DIASession::findSymbolByAddress(uint64_t Address, PDB_SymType Type) const { if (S_OK != Session->findSymbolByRVA(RVA, EnumVal, &Symbol)) return nullptr; } - auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, Symbol); + auto RawSymbol = std::make_unique<DIARawSymbol>(*this, Symbol); return PDBSymbol::create(*this, std::move(RawSymbol)); } @@ -222,7 +214,7 @@ std::unique_ptr<PDBSymbol> DIASession::findSymbolByRVA(uint32_t RVA, if (S_OK != Session->findSymbolByRVA(RVA, EnumVal, &Symbol)) return nullptr; - auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, Symbol); + auto RawSymbol = std::make_unique<DIARawSymbol>(*this, Symbol); return PDBSymbol::create(*this, std::move(RawSymbol)); } @@ -235,7 +227,7 @@ DIASession::findSymbolBySectOffset(uint32_t Sect, uint32_t Offset, if (S_OK != Session->findSymbolByAddr(Sect, Offset, EnumVal, &Symbol)) return nullptr; - auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, Symbol); + auto RawSymbol = std::make_unique<DIARawSymbol>(*this, Symbol); return PDBSymbol::create(*this, std::move(RawSymbol)); } @@ -251,7 +243,7 @@ DIASession::findLineNumbers(const PDBSymbolCompiland &Compiland, RawFile.getDiaFile(), &LineNumbers)) return nullptr; - return llvm::make_unique<DIAEnumLineNumbers>(LineNumbers); + return std::make_unique<DIAEnumLineNumbers>(LineNumbers); } std::unique_ptr<IPDBEnumLineNumbers> @@ -265,7 +257,7 @@ DIASession::findLineNumbersByAddress(uint64_t Address, uint32_t Length) const { if (S_OK != Session->findLinesByRVA(RVA, Length, &LineNumbers)) return nullptr; } - return llvm::make_unique<DIAEnumLineNumbers>(LineNumbers); + return std::make_unique<DIAEnumLineNumbers>(LineNumbers); } std::unique_ptr<IPDBEnumLineNumbers> @@ -274,7 +266,7 @@ DIASession::findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const { if (S_OK != Session->findLinesByRVA(RVA, Length, &LineNumbers)) return nullptr; - return llvm::make_unique<DIAEnumLineNumbers>(LineNumbers); + return std::make_unique<DIAEnumLineNumbers>(LineNumbers); } std::unique_ptr<IPDBEnumLineNumbers> @@ -284,7 +276,7 @@ DIASession::findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, if (S_OK != Session->findLinesByAddr(Section, Offset, Length, &LineNumbers)) return nullptr; - return llvm::make_unique<DIAEnumLineNumbers>(LineNumbers); + return std::make_unique<DIAEnumLineNumbers>(LineNumbers); } std::unique_ptr<IPDBEnumSourceFiles> @@ -306,7 +298,7 @@ DIASession::findSourceFiles(const PDBSymbolCompiland *Compiland, if (S_OK != Session->findFile(DiaCompiland, Utf16Pattern.m_str, Flags, &SourceFiles)) return nullptr; - return llvm::make_unique<DIAEnumSourceFiles>(*this, SourceFiles); + return std::make_unique<DIAEnumSourceFiles>(*this, SourceFiles); } std::unique_ptr<IPDBSourceFile> @@ -342,7 +334,7 @@ std::unique_ptr<IPDBEnumSourceFiles> DIASession::getAllSourceFiles() const { if (S_OK != Session->findFile(nullptr, nullptr, nsNone, &Files)) return nullptr; - return llvm::make_unique<DIAEnumSourceFiles>(*this, Files); + return std::make_unique<DIAEnumSourceFiles>(*this, Files); } std::unique_ptr<IPDBEnumSourceFiles> DIASession::getSourceFilesForCompiland( @@ -355,7 +347,7 @@ std::unique_ptr<IPDBEnumSourceFiles> DIASession::getSourceFilesForCompiland( Session->findFile(RawSymbol.getDiaSymbol(), nullptr, nsNone, &Files)) return nullptr; - return llvm::make_unique<DIAEnumSourceFiles>(*this, Files); + return std::make_unique<DIAEnumSourceFiles>(*this, Files); } std::unique_ptr<IPDBSourceFile> @@ -364,7 +356,7 @@ DIASession::getSourceFileById(uint32_t FileId) const { if (S_OK != Session->findFileById(FileId, &LocatedFile)) return nullptr; - return llvm::make_unique<DIASourceFile>(*this, LocatedFile); + return std::make_unique<DIASourceFile>(*this, LocatedFile); } std::unique_ptr<IPDBEnumDataStreams> DIASession::getDebugStreams() const { @@ -372,7 +364,7 @@ std::unique_ptr<IPDBEnumDataStreams> DIASession::getDebugStreams() const { if (S_OK != Session->getEnumDebugStreams(&DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumDebugStreams>(DiaEnumerator); + return std::make_unique<DIAEnumDebugStreams>(DiaEnumerator); } std::unique_ptr<IPDBEnumTables> DIASession::getEnumTables() const { @@ -380,7 +372,7 @@ std::unique_ptr<IPDBEnumTables> DIASession::getEnumTables() const { if (S_OK != Session->getEnumTables(&DiaEnumerator)) return nullptr; - return llvm::make_unique<DIAEnumTables>(DiaEnumerator); + return std::make_unique<DIAEnumTables>(DiaEnumerator); } template <class T> static CComPtr<T> getTableEnumerator(IDiaSession &Session) { @@ -407,7 +399,7 @@ DIASession::getInjectedSources() const { if (!Files) return nullptr; - return llvm::make_unique<DIAEnumInjectedSources>(Files); + return std::make_unique<DIAEnumInjectedSources>(Files); } std::unique_ptr<IPDBEnumSectionContribs> @@ -417,7 +409,7 @@ DIASession::getSectionContribs() const { if (!Sections) return nullptr; - return llvm::make_unique<DIAEnumSectionContribs>(*this, Sections); + return std::make_unique<DIAEnumSectionContribs>(*this, Sections); } std::unique_ptr<IPDBEnumFrameData> @@ -427,5 +419,5 @@ DIASession::getFrameData() const { if (!FD) return nullptr; - return llvm::make_unique<DIAEnumFrameData>(FD); + return std::make_unique<DIAEnumFrameData>(FD); } diff --git a/lib/DebugInfo/PDB/GenericError.cpp b/lib/DebugInfo/PDB/GenericError.cpp index 70dc094c42ec..0e4cba3174b2 100644 --- a/lib/DebugInfo/PDB/GenericError.cpp +++ b/lib/DebugInfo/PDB/GenericError.cpp @@ -34,8 +34,8 @@ public: return "The PDB file path is an invalid UTF8 sequence."; case pdb_error_code::signature_out_of_date: return "The signature does not match; the file(s) might be out of date."; - case pdb_error_code::external_cmdline_ref: - return "The path to this file must be provided on the command-line."; + case pdb_error_code::no_matching_pch: + return "No matching precompiled header could be located."; } llvm_unreachable("Unrecognized generic_error_code"); } diff --git a/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp b/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp index 20b6c6142547..419734771ccd 100644 --- a/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp +++ b/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp @@ -180,12 +180,12 @@ Error DbiModuleDescriptorBuilder::commit(BinaryStreamWriter &ModiWriter, void DbiModuleDescriptorBuilder::addDebugSubsection( std::shared_ptr<DebugSubsection> Subsection) { assert(Subsection); - C13Builders.push_back(llvm::make_unique<DebugSubsectionRecordBuilder>( + C13Builders.push_back(std::make_unique<DebugSubsectionRecordBuilder>( std::move(Subsection), CodeViewContainer::Pdb)); } void DbiModuleDescriptorBuilder::addDebugSubsection( const DebugSubsectionRecord &SubsectionContents) { - C13Builders.push_back(llvm::make_unique<DebugSubsectionRecordBuilder>( + C13Builders.push_back(std::make_unique<DebugSubsectionRecordBuilder>( SubsectionContents, CodeViewContainer::Pdb)); } diff --git a/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp b/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp index b7ade0072ee5..0e00c2f7ff98 100644 --- a/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp +++ b/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp @@ -114,7 +114,7 @@ Expected<DbiModuleDescriptorBuilder &> DbiStreamBuilder::addModuleInfo(StringRef ModuleName) { uint32_t Index = ModiList.size(); ModiList.push_back( - llvm::make_unique<DbiModuleDescriptorBuilder>(ModuleName, Index, Msf)); + std::make_unique<DbiModuleDescriptorBuilder>(ModuleName, Index, Msf)); return *ModiList.back(); } diff --git a/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp b/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp index 8ed5b8b44c59..432f1e9b24d3 100644 --- a/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp +++ b/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp @@ -183,8 +183,8 @@ void GSIHashStreamBuilder::finalizeBuckets(uint32_t RecordZeroOffset) { } GSIStreamBuilder::GSIStreamBuilder(msf::MSFBuilder &Msf) - : Msf(Msf), PSH(llvm::make_unique<GSIHashStreamBuilder>()), - GSH(llvm::make_unique<GSIHashStreamBuilder>()) {} + : Msf(Msf), PSH(std::make_unique<GSIHashStreamBuilder>()), + GSH(std::make_unique<GSIHashStreamBuilder>()) {} GSIStreamBuilder::~GSIStreamBuilder() {} diff --git a/lib/DebugInfo/PDB/Native/Hash.cpp b/lib/DebugInfo/PDB/Native/Hash.cpp index b5c139ecbec0..7fb6b4bd5d31 100644 --- a/lib/DebugInfo/PDB/Native/Hash.cpp +++ b/lib/DebugInfo/PDB/Native/Hash.cpp @@ -8,8 +8,8 @@ #include "llvm/DebugInfo/PDB/Native/Hash.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/CRC.h" #include "llvm/Support/Endian.h" -#include "llvm/Support/JamCRC.h" #include <cstdint> using namespace llvm; @@ -79,7 +79,6 @@ uint32_t pdb::hashStringV2(StringRef Str) { // Corresponds to `SigForPbCb` in langapi/shared/crc32.h. uint32_t pdb::hashBufferV8(ArrayRef<uint8_t> Buf) { JamCRC JC(/*Init=*/0U); - JC.update(makeArrayRef<char>(reinterpret_cast<const char *>(Buf.data()), - Buf.size())); + JC.update(Buf); return JC.getCRC(); } diff --git a/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp b/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp index f17ff5bb01f2..2f6a5bc3d574 100644 --- a/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp +++ b/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp @@ -46,30 +46,31 @@ public: uint64_t getCodeByteSize() const override { return Entry.FileSize; } std::string getFileName() const override { - auto Name = Strings.getStringForID(Entry.FileNI); - assert(Name && "InjectedSourceStream should have rejected this"); - return *Name; + StringRef Ret = cantFail(Strings.getStringForID(Entry.FileNI), + "InjectedSourceStream should have rejected this"); + return Ret; } std::string getObjectFileName() const override { - auto ObjName = Strings.getStringForID(Entry.ObjNI); - assert(ObjName && "InjectedSourceStream should have rejected this"); - return *ObjName; + StringRef Ret = cantFail(Strings.getStringForID(Entry.ObjNI), + "InjectedSourceStream should have rejected this"); + return Ret; } std::string getVirtualFileName() const override { - auto VName = Strings.getStringForID(Entry.VFileNI); - assert(VName && "InjectedSourceStream should have rejected this"); - return *VName; + StringRef Ret = cantFail(Strings.getStringForID(Entry.VFileNI), + "InjectedSourceStream should have rejected this"); + return Ret; } uint32_t getCompression() const override { return Entry.Compression; } std::string getCode() const override { // Get name of stream storing the data. - auto VName = Strings.getStringForID(Entry.VFileNI); - assert(VName && "InjectedSourceStream should have rejected this"); - std::string StreamName = ("/src/files/" + *VName).str(); + StringRef VName = + cantFail(Strings.getStringForID(Entry.VFileNI), + "InjectedSourceStream should have rejected this"); + std::string StreamName = ("/src/files/" + VName).str(); // Find stream with that name and read its data. // FIXME: Consider validating (or even loading) all this in @@ -104,14 +105,14 @@ std::unique_ptr<IPDBInjectedSource> NativeEnumInjectedSources::getChildAtIndex(uint32_t N) const { if (N >= getChildCount()) return nullptr; - return make_unique<NativeInjectedSource>(std::next(Stream.begin(), N)->second, + return std::make_unique<NativeInjectedSource>(std::next(Stream.begin(), N)->second, File, Strings); } std::unique_ptr<IPDBInjectedSource> NativeEnumInjectedSources::getNext() { if (Cur == Stream.end()) return nullptr; - return make_unique<NativeInjectedSource>((Cur++)->second, File, Strings); + return std::make_unique<NativeInjectedSource>((Cur++)->second, File, Strings); } void NativeEnumInjectedSources::reset() { Cur = Stream.begin(); } diff --git a/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp b/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp index 8e43cf24495a..2ad552470b61 100644 --- a/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp +++ b/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp @@ -30,68 +30,68 @@ void NativeRawSymbol::dump(raw_ostream &OS, int Indent, std::unique_ptr<IPDBEnumSymbols> NativeRawSymbol::findChildren(PDB_SymType Type) const { - return llvm::make_unique<NullEnumerator<PDBSymbol>>(); + return std::make_unique<NullEnumerator<PDBSymbol>>(); } std::unique_ptr<IPDBEnumSymbols> NativeRawSymbol::findChildren(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags) const { - return llvm::make_unique<NullEnumerator<PDBSymbol>>(); + return std::make_unique<NullEnumerator<PDBSymbol>>(); } std::unique_ptr<IPDBEnumSymbols> NativeRawSymbol::findChildrenByAddr(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t Section, uint32_t Offset) const { - return llvm::make_unique<NullEnumerator<PDBSymbol>>(); + return std::make_unique<NullEnumerator<PDBSymbol>>(); } std::unique_ptr<IPDBEnumSymbols> NativeRawSymbol::findChildrenByVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint64_t VA) const { - return llvm::make_unique<NullEnumerator<PDBSymbol>>(); + return std::make_unique<NullEnumerator<PDBSymbol>>(); } std::unique_ptr<IPDBEnumSymbols> NativeRawSymbol::findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t RVA) const { - return llvm::make_unique<NullEnumerator<PDBSymbol>>(); + return std::make_unique<NullEnumerator<PDBSymbol>>(); } std::unique_ptr<IPDBEnumSymbols> NativeRawSymbol::findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const { - return llvm::make_unique<NullEnumerator<PDBSymbol>>(); + return std::make_unique<NullEnumerator<PDBSymbol>>(); } std::unique_ptr<IPDBEnumSymbols> NativeRawSymbol::findInlineFramesByRVA(uint32_t RVA) const { - return llvm::make_unique<NullEnumerator<PDBSymbol>>(); + return std::make_unique<NullEnumerator<PDBSymbol>>(); } std::unique_ptr<IPDBEnumSymbols> NativeRawSymbol::findInlineFramesByVA(uint64_t VA) const { - return llvm::make_unique<NullEnumerator<PDBSymbol>>(); + return std::make_unique<NullEnumerator<PDBSymbol>>(); } std::unique_ptr<IPDBEnumLineNumbers> NativeRawSymbol::findInlineeLines() const { - return llvm::make_unique<NullEnumerator<IPDBLineNumber>>(); + return std::make_unique<NullEnumerator<IPDBLineNumber>>(); } std::unique_ptr<IPDBEnumLineNumbers> NativeRawSymbol::findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, uint32_t Length) const { - return llvm::make_unique<NullEnumerator<IPDBLineNumber>>(); + return std::make_unique<NullEnumerator<IPDBLineNumber>>(); } std::unique_ptr<IPDBEnumLineNumbers> NativeRawSymbol::findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const { - return llvm::make_unique<NullEnumerator<IPDBLineNumber>>(); + return std::make_unique<NullEnumerator<IPDBLineNumber>>(); } std::unique_ptr<IPDBEnumLineNumbers> NativeRawSymbol::findInlineeLinesByVA(uint64_t VA, uint32_t Length) const { - return llvm::make_unique<NullEnumerator<IPDBLineNumber>>(); + return std::make_unique<NullEnumerator<IPDBLineNumber>>(); } void NativeRawSymbol::getDataBytes(SmallVector<uint8_t, 32> &bytes) const { diff --git a/lib/DebugInfo/PDB/Native/NativeSession.cpp b/lib/DebugInfo/PDB/Native/NativeSession.cpp index 8a49cb1c5963..b45a5881dcb5 100644 --- a/lib/DebugInfo/PDB/Native/NativeSession.cpp +++ b/lib/DebugInfo/PDB/Native/NativeSession.cpp @@ -59,18 +59,18 @@ NativeSession::~NativeSession() = default; Error NativeSession::createFromPdb(std::unique_ptr<MemoryBuffer> Buffer, std::unique_ptr<IPDBSession> &Session) { StringRef Path = Buffer->getBufferIdentifier(); - auto Stream = llvm::make_unique<MemoryBufferByteStream>( + auto Stream = std::make_unique<MemoryBufferByteStream>( std::move(Buffer), llvm::support::little); - auto Allocator = llvm::make_unique<BumpPtrAllocator>(); - auto File = llvm::make_unique<PDBFile>(Path, std::move(Stream), *Allocator); + auto Allocator = std::make_unique<BumpPtrAllocator>(); + auto File = std::make_unique<PDBFile>(Path, std::move(Stream), *Allocator); if (auto EC = File->parseFileHeaders()) return EC; if (auto EC = File->parseStreamData()) return EC; Session = - llvm::make_unique<NativeSession>(std::move(File), std::move(Allocator)); + std::make_unique<NativeSession>(std::move(File), std::move(Allocator)); return Error::success(); } @@ -202,7 +202,7 @@ NativeSession::getInjectedSources() const { consumeError(Strings.takeError()); return nullptr; } - return make_unique<NativeEnumInjectedSources>(*Pdb, *ISS, *Strings); + return std::make_unique<NativeEnumInjectedSources>(*Pdb, *ISS, *Strings); } std::unique_ptr<IPDBEnumSectionContribs> diff --git a/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp b/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp index 9f5e86281a23..26ccb7daece0 100644 --- a/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp +++ b/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp @@ -163,14 +163,14 @@ void NativeTypeEnum::dump(raw_ostream &OS, int Indent, std::unique_ptr<IPDBEnumSymbols> NativeTypeEnum::findChildren(PDB_SymType Type) const { if (Type != PDB_SymType::Data) - return llvm::make_unique<NullEnumerator<PDBSymbol>>(); + return std::make_unique<NullEnumerator<PDBSymbol>>(); const NativeTypeEnum *ClassParent = nullptr; if (!Modifiers) ClassParent = this; else ClassParent = UnmodifiedType; - return llvm::make_unique<NativeEnumEnumEnumerators>(Session, *ClassParent); + return std::make_unique<NativeEnumEnumEnumerators>(Session, *ClassParent); } PDB_SymType NativeTypeEnum::getSymTag() const { return PDB_SymType::Enum; } diff --git a/lib/DebugInfo/PDB/Native/NativeTypeFunctionSig.cpp b/lib/DebugInfo/PDB/Native/NativeTypeFunctionSig.cpp index 405303469c18..f98a4c3043eb 100644 --- a/lib/DebugInfo/PDB/Native/NativeTypeFunctionSig.cpp +++ b/lib/DebugInfo/PDB/Native/NativeTypeFunctionSig.cpp @@ -65,7 +65,7 @@ private: std::unique_ptr<PDBSymbol> wrap(std::unique_ptr<PDBSymbol> S) const { if (!S) return nullptr; - auto NTFA = llvm::make_unique<NativeTypeFunctionArg>(Session, std::move(S)); + auto NTFA = std::make_unique<NativeTypeFunctionArg>(Session, std::move(S)); return PDBSymbol::create(Session, std::move(NTFA)); } NativeSession &Session; @@ -133,9 +133,9 @@ void NativeTypeFunctionSig::dump(raw_ostream &OS, int Indent, std::unique_ptr<IPDBEnumSymbols> NativeTypeFunctionSig::findChildren(PDB_SymType Type) const { if (Type != PDB_SymType::FunctionArg) - return llvm::make_unique<NullEnumerator<PDBSymbol>>(); + return std::make_unique<NullEnumerator<PDBSymbol>>(); - auto NET = llvm::make_unique<NativeEnumTypes>(Session, + auto NET = std::make_unique<NativeEnumTypes>(Session, /* copy */ ArgList.ArgIndices); return std::unique_ptr<IPDBEnumSymbols>( new NativeEnumFunctionArgs(Session, std::move(NET))); diff --git a/lib/DebugInfo/PDB/Native/PDBFile.cpp b/lib/DebugInfo/PDB/Native/PDBFile.cpp index 983031dfcb78..9ac226b89139 100644 --- a/lib/DebugInfo/PDB/Native/PDBFile.cpp +++ b/lib/DebugInfo/PDB/Native/PDBFile.cpp @@ -264,7 +264,7 @@ Expected<GlobalsStream &> PDBFile::getPDBGlobalsStream() { safelyCreateIndexedStream(DbiS->getGlobalSymbolStreamIndex()); if (!GlobalS) return GlobalS.takeError(); - auto TempGlobals = llvm::make_unique<GlobalsStream>(std::move(*GlobalS)); + auto TempGlobals = std::make_unique<GlobalsStream>(std::move(*GlobalS)); if (auto EC = TempGlobals->reload()) return std::move(EC); Globals = std::move(TempGlobals); @@ -277,7 +277,7 @@ Expected<InfoStream &> PDBFile::getPDBInfoStream() { auto InfoS = safelyCreateIndexedStream(StreamPDB); if (!InfoS) return InfoS.takeError(); - auto TempInfo = llvm::make_unique<InfoStream>(std::move(*InfoS)); + auto TempInfo = std::make_unique<InfoStream>(std::move(*InfoS)); if (auto EC = TempInfo->reload()) return std::move(EC); Info = std::move(TempInfo); @@ -290,7 +290,7 @@ Expected<DbiStream &> PDBFile::getPDBDbiStream() { auto DbiS = safelyCreateIndexedStream(StreamDBI); if (!DbiS) return DbiS.takeError(); - auto TempDbi = llvm::make_unique<DbiStream>(std::move(*DbiS)); + auto TempDbi = std::make_unique<DbiStream>(std::move(*DbiS)); if (auto EC = TempDbi->reload(this)) return std::move(EC); Dbi = std::move(TempDbi); @@ -303,7 +303,7 @@ Expected<TpiStream &> PDBFile::getPDBTpiStream() { auto TpiS = safelyCreateIndexedStream(StreamTPI); if (!TpiS) return TpiS.takeError(); - auto TempTpi = llvm::make_unique<TpiStream>(*this, std::move(*TpiS)); + auto TempTpi = std::make_unique<TpiStream>(*this, std::move(*TpiS)); if (auto EC = TempTpi->reload()) return std::move(EC); Tpi = std::move(TempTpi); @@ -319,7 +319,7 @@ Expected<TpiStream &> PDBFile::getPDBIpiStream() { auto IpiS = safelyCreateIndexedStream(StreamIPI); if (!IpiS) return IpiS.takeError(); - auto TempIpi = llvm::make_unique<TpiStream>(*this, std::move(*IpiS)); + auto TempIpi = std::make_unique<TpiStream>(*this, std::move(*IpiS)); if (auto EC = TempIpi->reload()) return std::move(EC); Ipi = std::move(TempIpi); @@ -337,7 +337,7 @@ Expected<PublicsStream &> PDBFile::getPDBPublicsStream() { safelyCreateIndexedStream(DbiS->getPublicSymbolStreamIndex()); if (!PublicS) return PublicS.takeError(); - auto TempPublics = llvm::make_unique<PublicsStream>(std::move(*PublicS)); + auto TempPublics = std::make_unique<PublicsStream>(std::move(*PublicS)); if (auto EC = TempPublics->reload()) return std::move(EC); Publics = std::move(TempPublics); @@ -356,7 +356,7 @@ Expected<SymbolStream &> PDBFile::getPDBSymbolStream() { if (!SymbolS) return SymbolS.takeError(); - auto TempSymbols = llvm::make_unique<SymbolStream>(std::move(*SymbolS)); + auto TempSymbols = std::make_unique<SymbolStream>(std::move(*SymbolS)); if (auto EC = TempSymbols->reload()) return std::move(EC); Symbols = std::move(TempSymbols); @@ -370,7 +370,7 @@ Expected<PDBStringTable &> PDBFile::getStringTable() { if (!NS) return NS.takeError(); - auto N = llvm::make_unique<PDBStringTable>(); + auto N = std::make_unique<PDBStringTable>(); BinaryStreamReader Reader(**NS); if (auto EC = N->reload(Reader)) return std::move(EC); @@ -391,7 +391,7 @@ Expected<InjectedSourceStream &> PDBFile::getInjectedSourceStream() { if (!Strings) return Strings.takeError(); - auto IJ = llvm::make_unique<InjectedSourceStream>(std::move(*IJS)); + auto IJ = std::make_unique<InjectedSourceStream>(std::move(*IJS)); if (auto EC = IJ->reload(*Strings)) return std::move(EC); InjectedSources = std::move(IJ); diff --git a/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp b/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp index 8f5a048ea4b5..aa3288724390 100644 --- a/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp +++ b/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp @@ -22,7 +22,7 @@ #include "llvm/DebugInfo/PDB/Native/TpiStreamBuilder.h" #include "llvm/Support/BinaryStream.h" #include "llvm/Support/BinaryStreamWriter.h" -#include "llvm/Support/JamCRC.h" +#include "llvm/Support/CRC.h" #include "llvm/Support/Path.h" #include "llvm/Support/xxhash.h" @@ -42,7 +42,7 @@ Error PDBFileBuilder::initialize(uint32_t BlockSize) { auto ExpectedMsf = MSFBuilder::create(Allocator, BlockSize); if (!ExpectedMsf) return ExpectedMsf.takeError(); - Msf = llvm::make_unique<MSFBuilder>(std::move(*ExpectedMsf)); + Msf = std::make_unique<MSFBuilder>(std::move(*ExpectedMsf)); return Error::success(); } @@ -50,25 +50,25 @@ MSFBuilder &PDBFileBuilder::getMsfBuilder() { return *Msf; } InfoStreamBuilder &PDBFileBuilder::getInfoBuilder() { if (!Info) - Info = llvm::make_unique<InfoStreamBuilder>(*Msf, NamedStreams); + Info = std::make_unique<InfoStreamBuilder>(*Msf, NamedStreams); return *Info; } DbiStreamBuilder &PDBFileBuilder::getDbiBuilder() { if (!Dbi) - Dbi = llvm::make_unique<DbiStreamBuilder>(*Msf); + Dbi = std::make_unique<DbiStreamBuilder>(*Msf); return *Dbi; } TpiStreamBuilder &PDBFileBuilder::getTpiBuilder() { if (!Tpi) - Tpi = llvm::make_unique<TpiStreamBuilder>(*Msf, StreamTPI); + Tpi = std::make_unique<TpiStreamBuilder>(*Msf, StreamTPI); return *Tpi; } TpiStreamBuilder &PDBFileBuilder::getIpiBuilder() { if (!Ipi) - Ipi = llvm::make_unique<TpiStreamBuilder>(*Msf, StreamIPI); + Ipi = std::make_unique<TpiStreamBuilder>(*Msf, StreamIPI); return *Ipi; } @@ -78,7 +78,7 @@ PDBStringTableBuilder &PDBFileBuilder::getStringTableBuilder() { GSIStreamBuilder &PDBFileBuilder::getGsiBuilder() { if (!Gsi) - Gsi = llvm::make_unique<GSIStreamBuilder>(*Msf); + Gsi = std::make_unique<GSIStreamBuilder>(*Msf); return *Gsi; } @@ -174,8 +174,7 @@ Error PDBFileBuilder::finalizeMsfLayout() { if (!InjectedSources.empty()) { for (const auto &IS : InjectedSources) { JamCRC CRC(0); - CRC.update(makeArrayRef(IS.Content->getBufferStart(), - IS.Content->getBufferSize())); + CRC.update(arrayRefFromStringRef(IS.Content->getBuffer())); SrcHeaderBlockEntry Entry; ::memset(&Entry, 0, sizeof(SrcHeaderBlockEntry)); diff --git a/lib/DebugInfo/PDB/Native/TpiHashing.cpp b/lib/DebugInfo/PDB/Native/TpiHashing.cpp index b21b82bf76fd..b71b2b158144 100644 --- a/lib/DebugInfo/PDB/Native/TpiHashing.cpp +++ b/lib/DebugInfo/PDB/Native/TpiHashing.cpp @@ -10,7 +10,7 @@ #include "llvm/DebugInfo/CodeView/TypeDeserializer.h" #include "llvm/DebugInfo/PDB/Native/Hash.h" -#include "llvm/Support/JamCRC.h" +#include "llvm/Support/CRC.h" using namespace llvm; using namespace llvm::codeview; @@ -124,8 +124,6 @@ Expected<uint32_t> llvm::pdb::hashTypeRecord(const CVType &Rec) { // Run CRC32 over the bytes. This corresponds to `hashBufv8`. JamCRC JC(/*Init=*/0U); - ArrayRef<char> Bytes(reinterpret_cast<const char *>(Rec.data().data()), - Rec.data().size()); - JC.update(Bytes); + JC.update(Rec.data()); return JC.getCRC(); } diff --git a/lib/DebugInfo/PDB/Native/TpiStream.cpp b/lib/DebugInfo/PDB/Native/TpiStream.cpp index 8ee7f897b8bb..ac19db03fab2 100644 --- a/lib/DebugInfo/PDB/Native/TpiStream.cpp +++ b/lib/DebugInfo/PDB/Native/TpiStream.cpp @@ -112,7 +112,7 @@ Error TpiStream::reload() { HashStream = std::move(*HS); } - Types = llvm::make_unique<LazyRandomTypeCollection>( + Types = std::make_unique<LazyRandomTypeCollection>( TypeRecords, getNumTypeRecords(), getTypeIndexOffsets()); return Error::success(); } diff --git a/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp b/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp index 6b308453c2de..4f10f8524a9b 100644 --- a/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp +++ b/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp @@ -135,7 +135,7 @@ Error TpiStreamBuilder::finalizeMsfLayout() { reinterpret_cast<const uint8_t *>(HashBuffer.data()), calculateHashBufferSize()); HashValueStream = - llvm::make_unique<BinaryByteStream>(Bytes, llvm::support::little); + std::make_unique<BinaryByteStream>(Bytes, llvm::support::little); } return Error::success(); } diff --git a/lib/DebugInfo/PDB/PDBSymbolFunc.cpp b/lib/DebugInfo/PDB/PDBSymbolFunc.cpp index 7c3ba981fd6b..cb0329bc0ed7 100644 --- a/lib/DebugInfo/PDB/PDBSymbolFunc.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolFunc.cpp @@ -79,7 +79,7 @@ private: std::unique_ptr<IPDBEnumChildren<PDBSymbolData>> PDBSymbolFunc::getArguments() const { - return llvm::make_unique<FunctionArgEnumerator>(Session, *this); + return std::make_unique<FunctionArgEnumerator>(Session, *this); } void PDBSymbolFunc::dump(PDBSymDumper &Dumper) const { Dumper.dump(*this); } diff --git a/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp b/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp index 292320a6fe6d..1373615522eb 100644 --- a/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp +++ b/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp @@ -63,7 +63,7 @@ private: std::unique_ptr<IPDBEnumSymbols> PDBSymbolTypeFunctionSig::getArguments() const { - return llvm::make_unique<FunctionArgEnumerator>(Session, *this); + return std::make_unique<FunctionArgEnumerator>(Session, *this); } void PDBSymbolTypeFunctionSig::dump(PDBSymDumper &Dumper) const { diff --git a/lib/DebugInfo/PDB/UDTLayout.cpp b/lib/DebugInfo/PDB/UDTLayout.cpp index acb1599480b0..a8e1d0a619ca 100644 --- a/lib/DebugInfo/PDB/UDTLayout.cpp +++ b/lib/DebugInfo/PDB/UDTLayout.cpp @@ -71,7 +71,7 @@ DataMemberLayoutItem::DataMemberLayoutItem( DataMember(std::move(Member)) { auto Type = DataMember->getType(); if (auto UDT = unique_dyn_cast<PDBSymbolTypeUDT>(Type)) { - UdtLayout = llvm::make_unique<ClassLayout>(std::move(UDT)); + UdtLayout = std::make_unique<ClassLayout>(std::move(UDT)); UsedBytes = UdtLayout->usedBytes(); } } @@ -84,7 +84,7 @@ VBPtrLayoutItem::VBPtrLayoutItem(const UDTLayoutBase &Parent, } const PDBSymbolData &DataMemberLayoutItem::getDataMember() { - return *dyn_cast<PDBSymbolData>(Symbol); + return *cast<PDBSymbolData>(Symbol); } bool DataMemberLayoutItem::hasUDTLayout() const { return UdtLayout != nullptr; } @@ -205,7 +205,7 @@ void UDTLayoutBase::initializeChildren(const PDBSymbol &Sym) { for (auto &Base : Bases) { uint32_t Offset = Base->getOffset(); // Non-virtual bases never get elided. - auto BL = llvm::make_unique<BaseClassLayout>(*this, Offset, false, + auto BL = std::make_unique<BaseClassLayout>(*this, Offset, false, std::move(Base)); AllBases.push_back(BL.get()); @@ -216,7 +216,7 @@ void UDTLayoutBase::initializeChildren(const PDBSymbol &Sym) { assert(VTables.size() <= 1); if (!VTables.empty()) { auto VTLayout = - llvm::make_unique<VTableLayoutItem>(*this, std::move(VTables[0])); + std::make_unique<VTableLayoutItem>(*this, std::move(VTables[0])); VTable = VTLayout.get(); @@ -224,7 +224,7 @@ void UDTLayoutBase::initializeChildren(const PDBSymbol &Sym) { } for (auto &Data : Members) { - auto DM = llvm::make_unique<DataMemberLayoutItem>(*this, std::move(Data)); + auto DM = std::make_unique<DataMemberLayoutItem>(*this, std::move(Data)); addChildToLayout(std::move(DM)); } @@ -236,7 +236,7 @@ void UDTLayoutBase::initializeChildren(const PDBSymbol &Sym) { int VBPO = VB->getVirtualBasePointerOffset(); if (!hasVBPtrAtOffset(VBPO)) { if (auto VBP = VB->getRawSymbol().getVirtualBaseTableType()) { - auto VBPL = llvm::make_unique<VBPtrLayoutItem>(*this, std::move(VBP), + auto VBPL = std::make_unique<VBPtrLayoutItem>(*this, std::move(VBP), VBPO, VBP->getLength()); VBPtr = VBPL.get(); addChildToLayout(std::move(VBPL)); @@ -250,7 +250,7 @@ void UDTLayoutBase::initializeChildren(const PDBSymbol &Sym) { uint32_t Offset = UsedBytes.find_last() + 1; bool Elide = (Parent != nullptr); auto BL = - llvm::make_unique<BaseClassLayout>(*this, Offset, Elide, std::move(VB)); + std::make_unique<BaseClassLayout>(*this, Offset, Elide, std::move(VB)); AllBases.push_back(BL.get()); // Only lay this virtual base out directly inside of *this* class if this |