abidw: add option to only emit file names (--short-locs)
authorMatthias Maennich <maennich@google.com>
Tue, 21 May 2019 04:39:22 +0000 (05:39 +0100)
committerDodji Seketeli <dodji@redhat.com>
Wed, 22 May 2019 12:33:45 +0000 (14:33 +0200)
commitf3f7537b6e06db38f6136a4342b8275784301585
tree9ca1596dd232d9aaadaede9b2cce828e479066f6
parentbf9e8b94480cc8de8fb80369060c7c1e520cdf0a
abidw: add option to only emit file names (--short-locs)

Various emitted directories contain machine specific information and
therefore break reproducibility of abidw's output across different
build paths.

Hence introduce --short-locs to only emit file names.

Thanks to earlier changes, adding an option boils down to adding it to
set_opts and to the write_context along with some auxiliary functions
for setting and getting.

* include/abg-writer.h (set_short_locs): Declare new function.
(set_common_options): Use it.
set_opts
* src/abg-writer.cc (write_context::m_short_locs): New data
member.
(write_context::write_context): Initialize it.
(write_context::{g,s}et_short_locs): Define new accessors.
(write_location, write_translation_unit, write_corpus): Honour the
new write_context::get_short_locs property.
(set_short_locs): Define new function.
* tools/abidw.cc (options::short_locs): New data member.
(display_usage): Help string for the new --no-show-locs option.
(parse_command_line): Parse the new --no-show-locs option.

Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-writer.h
src/abg-writer.cc
tools/abidw.cc