[PATCH] D67276: [DWARF] Add a unit test for DWARFUnit::getLength().
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 14:04:37 PDT 2019
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.
Looks good to me - thanks!
================
Comment at: unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp:3169-3175
+ StringMap<std::unique_ptr<MemoryBuffer>> Sections;
+ Sections.insert(std::make_pair(
+ "debug_info", MemoryBuffer::getMemBuffer(
+ StringRef(DebugInfoSecRaw, sizeof(DebugInfoSecRaw)))));
+ auto Context = DWARFContext::create(Sections, 8, true);
+ const auto &Obj = Context->getDWARFObj();
+ Obj.forEachInfoSections([&](const DWARFSection &Sec) {
----------------
ikudrin wrote:
> dblaikie wrote:
> > This intermediate step seems unnecessary - DWARFContext is basically passing back the string you put into the map, right?
> >
> > So maybe skipping all that and building the DWARFSEction around the StringRef around DebugInfoSecRaw and passing that into the DWARFDataExtractor.
> >
> >
> But we still need a DWARFContext to pass to Header.extract(), and we also need a DWARFObject to pass to DWARFDataExtractor, right? So, we can eliminate only the call to Obj.forEachInfoSection(), replacing it with an artificial DWARFSection, which does not seem much.
Ah, fair enough!
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67276/new/
https://reviews.llvm.org/D67276
More information about the llvm-commits
mailing list