[PATCH] D67276: [DWARF] Add a unit test for DWARFUnit::getLength().

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 21:00:02 PDT 2019


ikudrin marked an inline comment as done.
ikudrin added inline comments.


================
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) {
----------------
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.


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