diff mbox series

[1/3] abg-dwarf-reader: create new corpus unconditionally

Message ID 20210427112853.1338240-2-gprocida@google.com
State Superseded, archived
Headers show
Series always create fresh corpus objects | expand

Commit Message

Giuliano Procida April 27, 2021, 11:28 a.m. UTC
The DWARF reader appears to create a new corpus object only if one is
not already present. However, the only case where there can be
multiple corpora is when build_corpus_group_from_kernel_dist_under is
called and this function clears down the reader context, including the
current corpus, between reading ELF objects.

So it's clearer to just create a fresh corpus object unconditionally
in the DWARF reader.

	* src/abg-dwarf-reader.cc (read_debug_info_into_corpus):
	Create new corpus object unconditionally.

Signed-off-by: Giuliano Procida <gprocida@google.com>
 src/abg-dwarf-reader.cc | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
diff mbox series


diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc
index dd9d689c..28d1c73a 100644
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -14233,14 +14233,7 @@  static corpus_sptr
 read_debug_info_into_corpus(read_context& ctxt)
-  if (!ctxt.current_corpus())
-    {
-      corpus_sptr corp (new corpus(ctxt.env(), ctxt.elf_path()));
-      ctxt.current_corpus(corp);
-      if (!ctxt.env())
-	ctxt.env(corp->get_environment());
-    }
+  ctxt.current_corpus(std::make_shared<corpus>(ctxt.env(), ctxt.elf_path()));
   // First set some mundane properties of the corpus gathered from
   // ELF.