summaryrefslogtreecommitdiff
path: root/tools/llvm-pdbutil
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-pdbutil')
-rw-r--r--tools/llvm-pdbutil/BytesOutputStyle.cpp2
-rw-r--r--tools/llvm-pdbutil/DumpOutputStyle.cpp9
-rw-r--r--tools/llvm-pdbutil/ExplainOutputStyle.cpp2
-rw-r--r--tools/llvm-pdbutil/InputFile.cpp17
-rw-r--r--tools/llvm-pdbutil/MinimalSymbolDumper.cpp5
-rw-r--r--tools/llvm-pdbutil/PrettyTypeDumper.cpp4
-rw-r--r--tools/llvm-pdbutil/llvm-pdbutil.cpp10
7 files changed, 26 insertions, 23 deletions
diff --git a/tools/llvm-pdbutil/BytesOutputStyle.cpp b/tools/llvm-pdbutil/BytesOutputStyle.cpp
index 162d12c120b4..ffc907e09f11 100644
--- a/tools/llvm-pdbutil/BytesOutputStyle.cpp
+++ b/tools/llvm-pdbutil/BytesOutputStyle.cpp
@@ -457,7 +457,7 @@ BytesOutputStyle::initializeTypes(uint32_t StreamIdx) {
uint32_t Count = Tpi->getNumTypeRecords();
auto Offsets = Tpi->getTypeIndexOffsets();
TypeCollection =
- llvm::make_unique<LazyRandomTypeCollection>(Types, Count, Offsets);
+ std::make_unique<LazyRandomTypeCollection>(Types, Count, Offsets);
return *TypeCollection;
}
diff --git a/tools/llvm-pdbutil/DumpOutputStyle.cpp b/tools/llvm-pdbutil/DumpOutputStyle.cpp
index 962d4cf88a8a..4d82e0fd9174 100644
--- a/tools/llvm-pdbutil/DumpOutputStyle.cpp
+++ b/tools/llvm-pdbutil/DumpOutputStyle.cpp
@@ -1369,9 +1369,10 @@ Error DumpOutputStyle::dumpTypesFromObjectFile() {
LazyRandomTypeCollection Types(100);
for (const auto &S : getObj().sections()) {
- StringRef SectionName;
- if (auto EC = S.getName(SectionName))
- return errorCodeToError(EC);
+ Expected<StringRef> NameOrErr = S.getName();
+ if (!NameOrErr)
+ return NameOrErr.takeError();
+ StringRef SectionName = *NameOrErr;
// .debug$T is a standard CodeView type section, while .debug$P is the same
// format but used for MSVC precompiled header object files.
@@ -1551,7 +1552,7 @@ Error DumpOutputStyle::dumpModuleSymsForObj() {
Dumper.setSymbolGroup(&Strings);
for (auto Symbol : Symbols) {
if (auto EC = Visitor.visitSymbolRecord(Symbol)) {
- SymbolError = llvm::make_unique<Error>(std::move(EC));
+ SymbolError = std::make_unique<Error>(std::move(EC));
return;
}
}
diff --git a/tools/llvm-pdbutil/ExplainOutputStyle.cpp b/tools/llvm-pdbutil/ExplainOutputStyle.cpp
index 94faa0463981..3d2490509c03 100644
--- a/tools/llvm-pdbutil/ExplainOutputStyle.cpp
+++ b/tools/llvm-pdbutil/ExplainOutputStyle.cpp
@@ -64,7 +64,7 @@ Error ExplainOutputStyle::explainPdbFile() {
Error ExplainOutputStyle::explainBinaryFile() {
std::unique_ptr<BinaryByteStream> Stream =
- llvm::make_unique<BinaryByteStream>(File.unknown().getBuffer(),
+ std::make_unique<BinaryByteStream>(File.unknown().getBuffer(),
llvm::support::little);
switch (opts::explain::InputType) {
case opts::explain::InputFileType::DBIStream: {
diff --git a/tools/llvm-pdbutil/InputFile.cpp b/tools/llvm-pdbutil/InputFile.cpp
index bd23bfdbe31a..b316882de64d 100644
--- a/tools/llvm-pdbutil/InputFile.cpp
+++ b/tools/llvm-pdbutil/InputFile.cpp
@@ -66,12 +66,13 @@ getModuleDebugStream(PDBFile &File, StringRef &ModuleName, uint32_t Index) {
static inline bool isCodeViewDebugSubsection(object::SectionRef Section,
StringRef Name,
BinaryStreamReader &Reader) {
- StringRef SectionName;
- if (Section.getName(SectionName))
- return false;
-
- if (SectionName != Name)
+ if (Expected<StringRef> NameOrErr = Section.getName()) {
+ if (*NameOrErr != Name)
+ return false;
+ } else {
+ consumeError(NameOrErr.takeError());
return false;
+ }
Expected<StringRef> ContentsOrErr = Section.getContents();
if (!ContentsOrErr) {
@@ -384,7 +385,7 @@ InputFile::getOrCreateTypeCollection(TypeCollectionKind Kind) {
uint32_t Count = Stream.getNumTypeRecords();
auto Offsets = Stream.getTypeIndexOffsets();
Collection =
- llvm::make_unique<LazyRandomTypeCollection>(Array, Count, Offsets);
+ std::make_unique<LazyRandomTypeCollection>(Array, Count, Offsets);
return *Collection;
}
@@ -397,11 +398,11 @@ InputFile::getOrCreateTypeCollection(TypeCollectionKind Kind) {
if (!isDebugTSection(Section, Records))
continue;
- Types = llvm::make_unique<LazyRandomTypeCollection>(Records, 100);
+ Types = std::make_unique<LazyRandomTypeCollection>(Records, 100);
return *Types;
}
- Types = llvm::make_unique<LazyRandomTypeCollection>(100);
+ Types = std::make_unique<LazyRandomTypeCollection>(100);
return *Types;
}
diff --git a/tools/llvm-pdbutil/MinimalSymbolDumper.cpp b/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
index e5ae47050678..ebfa50625e76 100644
--- a/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
+++ b/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
@@ -569,8 +569,9 @@ Error MinimalSymbolDumper::visitKnownRecord(
Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
DefRangeFramePointerRelSym &Def) {
AutoIndent Indent(P, 7);
- P.formatLine("offset = {0}, range = {1}", Def.Offset, formatRange(Def.Range));
- P.formatLine("gaps = {2}", Def.Offset,
+ P.formatLine("offset = {0}, range = {1}", Def.Hdr.Offset,
+ formatRange(Def.Range));
+ P.formatLine("gaps = {2}", Def.Hdr.Offset,
formatGaps(P.getIndentLevel() + 9, Def.Gaps));
return Error::success();
}
diff --git a/tools/llvm-pdbutil/PrettyTypeDumper.cpp b/tools/llvm-pdbutil/PrettyTypeDumper.cpp
index e8f8e5aa62c9..2f7a39803ca5 100644
--- a/tools/llvm-pdbutil/PrettyTypeDumper.cpp
+++ b/tools/llvm-pdbutil/PrettyTypeDumper.cpp
@@ -117,7 +117,7 @@ filterAndSortClassDefs(LinePrinter &Printer, Enumerator &E,
continue;
}
- auto Layout = llvm::make_unique<ClassLayout>(std::move(Class));
+ auto Layout = std::make_unique<ClassLayout>(std::move(Class));
if (Layout->deepPaddingSize() < opts::pretty::PaddingThreshold) {
++Discarded;
continue;
@@ -259,7 +259,7 @@ void TypeDumper::start(const PDBSymbolExe &Exe) {
continue;
}
- auto Layout = llvm::make_unique<ClassLayout>(std::move(Class));
+ auto Layout = std::make_unique<ClassLayout>(std::move(Class));
if (Layout->deepPaddingSize() < opts::pretty::PaddingThreshold)
continue;
diff --git a/tools/llvm-pdbutil/llvm-pdbutil.cpp b/tools/llvm-pdbutil/llvm-pdbutil.cpp
index 785a98086791..9307300861d4 100644
--- a/tools/llvm-pdbutil/llvm-pdbutil.cpp
+++ b/tools/llvm-pdbutil/llvm-pdbutil.cpp
@@ -863,8 +863,8 @@ static void pdb2Yaml(StringRef Path) {
std::unique_ptr<IPDBSession> Session;
auto &File = loadPDB(Path, Session);
- auto O = llvm::make_unique<YAMLOutputStyle>(File);
- O = llvm::make_unique<YAMLOutputStyle>(File);
+ auto O = std::make_unique<YAMLOutputStyle>(File);
+ O = std::make_unique<YAMLOutputStyle>(File);
ExitOnErr(O->dump());
}
@@ -872,7 +872,7 @@ static void pdb2Yaml(StringRef Path) {
static void dumpRaw(StringRef Path) {
InputFile IF = ExitOnErr(InputFile::open(Path));
- auto O = llvm::make_unique<DumpOutputStyle>(IF);
+ auto O = std::make_unique<DumpOutputStyle>(IF);
ExitOnErr(O->dump());
}
@@ -880,7 +880,7 @@ static void dumpBytes(StringRef Path) {
std::unique_ptr<IPDBSession> Session;
auto &File = loadPDB(Path, Session);
- auto O = llvm::make_unique<BytesOutputStyle>(File);
+ auto O = std::make_unique<BytesOutputStyle>(File);
ExitOnErr(O->dump());
}
@@ -1347,7 +1347,7 @@ static void explain() {
ExitOnErr(InputFile::open(opts::explain::InputFilename.front(), true));
for (uint64_t Off : opts::explain::Offsets) {
- auto O = llvm::make_unique<ExplainOutputStyle>(IF, Off);
+ auto O = std::make_unique<ExplainOutputStyle>(IF, Off);
ExitOnErr(O->dump());
}