[PATCH] D122622: [llvm-pdbutil] Fix a crash due to Expected not checked before destruction
Alexandre Ganea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 28 18:26:24 PDT 2022
aganea accepted this revision.
aganea added a comment.
This revision is now accepted and ready to land.
LGTM with a comment:
================
Comment at: llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp:607
if (opts::dump::DumpSectionContribs) {
- std::vector<std::string> Sections = getSectionNames(getPdb());
- dumpSectionContrib(P, Desc.getSectionContrib(), Sections, 0);
+ auto Sections = getSectionNames(getPdb());
+ if (!Sections)
----------------
I think it could help future code readers - if the type of "Sections" was made explicit:
```
auto SectionsOrErr = getSectionNames(getPdb());
if (!SectionsOrErr)
return SectionsOrErr.takeError();
ArrayRef<std::string> Sections = *SectionsOrErr;
dumpSectionContrib(P, Desc.getSectionContrib(), Sections, 0);
```
or just
```
Expected<std::vector<std::string>> Sections = getSectionNames(getPdb());
```
================
Comment at: llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp:1964
- std::vector<std::string> Names = getSectionNames(getPdb());
- Visitor V(P, makeArrayRef(Names));
+ auto Names = getSectionNames(getPdb());
+ if (!Names)
----------------
Same here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122622/new/
https://reviews.llvm.org/D122622
More information about the llvm-commits
mailing list