2013-08-02 03:16:22 +00:00
|
|
|
// -*- Mode: C++ -*-
|
|
|
|
//
|
|
|
|
// Copyright (C) 2013 Red Hat, Inc.
|
|
|
|
//
|
|
|
|
// This file is part of the GNU Application Binary Interface Generic
|
|
|
|
// Analysis and Instrumentation Library (libabigail). This library is
|
|
|
|
// free software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU Lesser General Public License as published by the
|
|
|
|
// Free Software Foundation; either version 3, or (at your option) any
|
|
|
|
// later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Lesser Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this program; see the file COPYING-LGPLV3. If
|
|
|
|
// not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/// @file
|
|
|
|
|
|
|
|
#ifndef __ABG_IRFWD_H__
|
|
|
|
#define __ABG_IRFWD_H__
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <tr1/memory>
|
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <tr1/functional>
|
|
|
|
#include <typeinfo>
|
|
|
|
#include <utility> // for std::rel_ops, at least.
|
2013-12-07 07:07:54 +00:00
|
|
|
#include <ostream>
|
2013-08-02 03:16:22 +00:00
|
|
|
#include "abg-hash.h"
|
|
|
|
|
|
|
|
/// Toplevel namespace for libabigail.
|
|
|
|
namespace abigail
|
|
|
|
{
|
2013-10-10 08:11:35 +00:00
|
|
|
/**
|
|
|
|
@mainpage libabigail
|
2013-08-02 23:30:56 +00:00
|
|
|
|
|
|
|
|
2013-10-10 08:11:35 +00:00
|
|
|
The GNU Application Binary Interface Generic Analysis and
|
|
|
|
Instrumentation Library.
|
|
|
|
|
|
|
|
This is an interface to the GNU Compiler Collection for the
|
|
|
|
collection and analysis of compiler-generated binaries.
|
|
|
|
|
|
|
|
Checkout out the project homepage <a
|
|
|
|
href="http://sourceware.org/libabigail"> here</a>.
|
|
|
|
|
|
|
|
The current libabigail source code can be checked out with:
|
2014-01-14 14:39:34 +00:00
|
|
|
git clone git://sourceware.org/git/libabigail.git.
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
The mailing list to send messages and patches to is
|
|
|
|
libabigail@sourceware.org.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Inject some types.
|
|
|
|
using std::tr1::shared_ptr;
|
|
|
|
using std::string;
|
2013-12-12 14:40:52 +00:00
|
|
|
using std::vector;
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
// Pull in relational operators.
|
|
|
|
using namespace std::rel_ops;
|
|
|
|
|
|
|
|
// Forward declarations for corpus.
|
|
|
|
|
|
|
|
class corpus;
|
|
|
|
|
|
|
|
// Forward declarations for ir.
|
|
|
|
class location;
|
|
|
|
class location_manager;
|
|
|
|
class translation_unit;
|
|
|
|
class class_decl;
|
|
|
|
class class_tdecl;
|
|
|
|
class decl_base;
|
|
|
|
class enum_type_decl;
|
|
|
|
class function_decl;
|
|
|
|
class function_tdecl;
|
|
|
|
class function_type;
|
|
|
|
class global_scope;
|
|
|
|
class node_visitor;
|
|
|
|
class location;
|
|
|
|
class location_manager;
|
|
|
|
class method_type;
|
|
|
|
class namespace_decl;
|
|
|
|
class parameter;
|
|
|
|
class pointer_type_def;
|
|
|
|
class qualified_type_def;
|
|
|
|
class reference_type_def;
|
|
|
|
class scope_decl;
|
|
|
|
class scope_type_decl;
|
|
|
|
class template_decl;
|
|
|
|
class template_parameter;
|
|
|
|
class non_type_tparameter;
|
|
|
|
class type_tparameter;
|
|
|
|
class template_tparameter;
|
|
|
|
|
|
|
|
class type_composition;
|
|
|
|
class type_base;
|
|
|
|
class type_decl;
|
|
|
|
class typedef_decl;
|
|
|
|
class var_decl;
|
|
|
|
|
|
|
|
struct type_shared_ptr_equal;
|
|
|
|
struct traversable_base;
|
|
|
|
|
Fix class scope setting & member type de-serializing from dwarf
* include/abg-fwd.h (add_decl_to_scope, insert_decl_into_scope):
return the decl added to the scope.
(as_non_member_type, get_type_declaration): Declare new entry
points.
* include/abg-ir.h (class decl_base::insert_decl_into_scope):
Update this friend declaration.
(class scope_decl, class_decl): Update the friend add_decl_to_scope
declaration.
(scope_decl::add_member_decl): Return the added decl.
(class_decl_sptr): Move this typedef befoer the class_decl class
declaration.
(class_decl::definition_of_declaration_): New member.
(class_decl::{set_definition_of_declaration,
get_definition_of_declaration}): New accessors.
(class_decl::add_member_decl): Return the added member.
(class_decl::insert_member_type): New member.
(class_decl::member_base::access_specifier): Make this protected.
(class_decl::member_type): Make this inherit from type_vase.
(class_decl::member_type::type_): Remove this member.
(class_decl::member_type::as_type): Remove this accessor.
(class_decl::member_type::operator==(const type_base&)): New.
(class_decl::member_type::operator shared_ptr<type_base>() const):
Remove.
(class_decl::member_type::get_underlying_type): New.
(class_decl::member_type::operator==(const member_type&) const):
New.
* src/abg-comparison.cc
(class_diff::{ensure_lookup_tables_populated, report}): Adjust for
the removal of class_decl::member_type::as_type.
* src/abg-dwarf-reader.cc (scope_stack_type): Change this as a
typedef to stack<scope_decl*>.
(current_scope): Change return type from scope_decl_sptr to
scope_decl*.
(insert_decl_into_scope): New.
(build_namespace_decl_and_add_to_ir): Use insert_decl_into_scope
in lieu of add_decl_to_scope.
(build_class_type_and_add_to_ir): likewise. Link a class
definition to its declaration. Push the current scope on the
scope stack. Use as_non_member_type. Fix setting member types.
(get_scope_for_die): Look through declaration-only classe to get
its definition.
(build_qualified_type, build_pointer_type_def)
(build_reference_type, build_typedef_type, build_var_decl)
(build_function_decl): Use as_non_member_type.
(build_ir_node_from_die): Fix member variable & function adding.
* src/abg-ir.cc (scope_decl::{add_member_decl,
insert_member_decl}): Return the added member.
(add_decl_to_scope): Likewise.
(insert_decl_into_scope): Likewise.
(get_top_most_scope_under): Fix logic.
(get_type_declaration): New overload that return a decl_base*.
(as_non_member_type): New definition.
(class_decl::{get_definition_of_declaration,
set_definition_of_declaration, insert_member_decl}): Likewise.
(class_decl::add_member_decl): Re-write in terms of
class::insert_member_decl.
(class_decl::insert_member_type): New definition.
(class_decl::add_member_type): Re-write in terms of
class_decl::insert_member_type.
(class_decl::remove_member_type): Update for the
class_decl::member_type::as_type removal.
(class_decl::{add_data_member, add_member_function,
add_member_function_template, add_member_class_template}): Call
scope_decl::add_member_decl.
(class_decl::member_type::member_type): Update as the type now
virtually inherits from type_base.
(class_decl::member_type::{set,get}_access_specifier): New
definitions.
(class_decl::member_type::get_underlying_type): Likewise.
(class_decl::member_type::set_scope): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
(class_decl::member_type::operator==(const decl_base& other)):
There is no more class_decl::member_type::as_type.
(class_decl::member_type::operator==(const type_base& other)):
New.
(class_decl::member_type::get_pretty_representation): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
* src/abg-reader.cc (build_class_decl): New that add
add_member_decl adds even member types, no need to add it
explicitly anymore.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-13 11:27:47 +00:00
|
|
|
shared_ptr<decl_base>
|
2013-10-10 08:11:35 +00:00
|
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
|
|
|
|
Fix class scope setting & member type de-serializing from dwarf
* include/abg-fwd.h (add_decl_to_scope, insert_decl_into_scope):
return the decl added to the scope.
(as_non_member_type, get_type_declaration): Declare new entry
points.
* include/abg-ir.h (class decl_base::insert_decl_into_scope):
Update this friend declaration.
(class scope_decl, class_decl): Update the friend add_decl_to_scope
declaration.
(scope_decl::add_member_decl): Return the added decl.
(class_decl_sptr): Move this typedef befoer the class_decl class
declaration.
(class_decl::definition_of_declaration_): New member.
(class_decl::{set_definition_of_declaration,
get_definition_of_declaration}): New accessors.
(class_decl::add_member_decl): Return the added member.
(class_decl::insert_member_type): New member.
(class_decl::member_base::access_specifier): Make this protected.
(class_decl::member_type): Make this inherit from type_vase.
(class_decl::member_type::type_): Remove this member.
(class_decl::member_type::as_type): Remove this accessor.
(class_decl::member_type::operator==(const type_base&)): New.
(class_decl::member_type::operator shared_ptr<type_base>() const):
Remove.
(class_decl::member_type::get_underlying_type): New.
(class_decl::member_type::operator==(const member_type&) const):
New.
* src/abg-comparison.cc
(class_diff::{ensure_lookup_tables_populated, report}): Adjust for
the removal of class_decl::member_type::as_type.
* src/abg-dwarf-reader.cc (scope_stack_type): Change this as a
typedef to stack<scope_decl*>.
(current_scope): Change return type from scope_decl_sptr to
scope_decl*.
(insert_decl_into_scope): New.
(build_namespace_decl_and_add_to_ir): Use insert_decl_into_scope
in lieu of add_decl_to_scope.
(build_class_type_and_add_to_ir): likewise. Link a class
definition to its declaration. Push the current scope on the
scope stack. Use as_non_member_type. Fix setting member types.
(get_scope_for_die): Look through declaration-only classe to get
its definition.
(build_qualified_type, build_pointer_type_def)
(build_reference_type, build_typedef_type, build_var_decl)
(build_function_decl): Use as_non_member_type.
(build_ir_node_from_die): Fix member variable & function adding.
* src/abg-ir.cc (scope_decl::{add_member_decl,
insert_member_decl}): Return the added member.
(add_decl_to_scope): Likewise.
(insert_decl_into_scope): Likewise.
(get_top_most_scope_under): Fix logic.
(get_type_declaration): New overload that return a decl_base*.
(as_non_member_type): New definition.
(class_decl::{get_definition_of_declaration,
set_definition_of_declaration, insert_member_decl}): Likewise.
(class_decl::add_member_decl): Re-write in terms of
class::insert_member_decl.
(class_decl::insert_member_type): New definition.
(class_decl::add_member_type): Re-write in terms of
class_decl::insert_member_type.
(class_decl::remove_member_type): Update for the
class_decl::member_type::as_type removal.
(class_decl::{add_data_member, add_member_function,
add_member_function_template, add_member_class_template}): Call
scope_decl::add_member_decl.
(class_decl::member_type::member_type): Update as the type now
virtually inherits from type_base.
(class_decl::member_type::{set,get}_access_specifier): New
definitions.
(class_decl::member_type::get_underlying_type): Likewise.
(class_decl::member_type::set_scope): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
(class_decl::member_type::operator==(const decl_base& other)):
There is no more class_decl::member_type::as_type.
(class_decl::member_type::operator==(const type_base& other)):
New.
(class_decl::member_type::get_pretty_representation): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
* src/abg-reader.cc (build_class_decl): New that add
add_member_decl adds even member types, no need to add it
explicitly anymore.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-13 11:27:47 +00:00
|
|
|
shared_ptr<decl_base>
|
2013-10-10 08:11:35 +00:00
|
|
|
add_decl_to_scope (shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
|
|
|
|
2013-12-12 14:40:52 +00:00
|
|
|
const global_scope*
|
2013-10-10 08:11:35 +00:00
|
|
|
get_global_scope(const shared_ptr<decl_base>);
|
|
|
|
|
|
|
|
translation_unit*
|
|
|
|
get_translation_unit(const shared_ptr<decl_base>);
|
|
|
|
|
2013-12-11 19:28:18 +00:00
|
|
|
translation_unit*
|
|
|
|
get_translation_unit(decl_base*);
|
|
|
|
|
2013-10-10 08:11:35 +00:00
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_global_scope(const scope_decl*);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_global_scope(const shared_ptr<scope_decl>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_at_global_scope(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_at_class_scope(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
Use the same representation for member and non-member types
* include/abg-fwd.h (is_at_class_scope): Add new oveloads.
(as_non_member_type, as_non_member_class_decl): Remove.
(has_scope, is_member_decl, is_member_type): New function
declarations. (get_member_is_static, set_member_is_static):
Likewise. * include/abg-ir.h (enum access_specifier): Move to
the abigail:: namespace, from ...
(class_decl::access_specifier): ... here. (class
context_rel): New type. (decl_base::hash_as_member): New
hasher. (decl_base::context_): Change the type of this to
context_rel_sptr. (decl_base::get_context_rel): New protected
getter. (decl_base::get_scope): Move this out-of-line.
(class_decl::member_type): Remove.
(class_decl::member_types): Adjust this typedef.
(class_decl::{insert,add}_member_type): Make these take a
type_base_sptr now. (class_decl::add_member_type): Change the
overload that returned a member_type to return a
type_base_sptr. (get_member_access_specifier,
set_member_access_specifier): New function declarations. *
include/abg-comparison.h (class member_type_diff): Remove.
(compute_diff): Remove the overload for member_type_diff. *
src/abg-comparison.cc (compute_diff_for_types): Adjust for the
removal of class_decl::member_type.
(maybe_report_diff_for_class_members): New static function.
(report_name_size_and_alignment_changes): Do not report a name
change just because of a struct -> class change. ({var_diff,
enum_diff, function_decl_diff}::report): Use the new
maybe_report_diff_for_class_members. (class_diff::report):
Adjust for the removal of class_decl::member_type. Use the
new maybe_report_diff_for_class_members. (class member_diff):
Remove. * src/abg-dwarf-reader.cc (die_access_specifier)
(get_scope_for_die, build_translation_unit_and_add_to_ir)
(build_class_type_and_add_to_ir, build_function_decl)
(build_ir_node_from_die): Adjust. * abg-hash.cc (struct
decl_base::hash_as_member): Define. ({scope_type_decl,
enum_type_decl, typedef_decl}::hash::operator()): Use the
decl_base::hash_as_member.
* src/abg-ir.cc (decl_base::decl_base): Adjust.
(decl_base::get_scope): New out-of-line getter.
(decl_base::{operator==, set_scope): Adjust.
(has_scope, is_member_decl, is_member_type)
(get_member_access_specifier, set_member_access_specifier)
(get_member_is_static, set_member_is_static, is_at_class_scope):
New function definitions.
(as_non_member_type, as_non_member_class_decl): Remove.
(get_node_name): Adjust.
(class_decl::{class_decl, set_earlier_declaration,
insert_member_decl, insert_member_type, add_member_type):
Likewise.
(class_decl::member_type::*) Remove.
* src/abg-reader.cc (read_access, build_qualified_type_decl)
(build_reference_type_def, build_typedef_decl)
(build_class_decl): Adjust.
* src/abg-writer.cc (write_access, write_member_type)
(write_class_decl): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-13 10:13:54 +00:00
|
|
|
bool
|
|
|
|
is_at_class_scope(const decl_base*);
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_at_class_scope(const decl_base&);
|
|
|
|
|
2013-10-10 08:11:35 +00:00
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_at_template_scope(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_template_parameter(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
2013-12-14 09:03:09 +00:00
|
|
|
bool
|
|
|
|
is_type(const decl_base&);
|
|
|
|
|
2013-11-28 13:51:23 +00:00
|
|
|
shared_ptr<type_base>
|
2013-10-19 14:01:59 +00:00
|
|
|
is_type(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
2014-03-10 22:20:34 +00:00
|
|
|
shared_ptr<class_decl>
|
|
|
|
look_through_decl_only_class(shared_ptr<class_decl>);
|
|
|
|
|
2013-10-10 08:11:35 +00:00
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_var_decl(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_template_parm_composition_type(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_template_decl(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
|
|
|
bool
|
2013-10-19 14:01:59 +00:00
|
|
|
is_function_template_pattern(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
Fix class scope setting & member type de-serializing from dwarf
* include/abg-fwd.h (add_decl_to_scope, insert_decl_into_scope):
return the decl added to the scope.
(as_non_member_type, get_type_declaration): Declare new entry
points.
* include/abg-ir.h (class decl_base::insert_decl_into_scope):
Update this friend declaration.
(class scope_decl, class_decl): Update the friend add_decl_to_scope
declaration.
(scope_decl::add_member_decl): Return the added decl.
(class_decl_sptr): Move this typedef befoer the class_decl class
declaration.
(class_decl::definition_of_declaration_): New member.
(class_decl::{set_definition_of_declaration,
get_definition_of_declaration}): New accessors.
(class_decl::add_member_decl): Return the added member.
(class_decl::insert_member_type): New member.
(class_decl::member_base::access_specifier): Make this protected.
(class_decl::member_type): Make this inherit from type_vase.
(class_decl::member_type::type_): Remove this member.
(class_decl::member_type::as_type): Remove this accessor.
(class_decl::member_type::operator==(const type_base&)): New.
(class_decl::member_type::operator shared_ptr<type_base>() const):
Remove.
(class_decl::member_type::get_underlying_type): New.
(class_decl::member_type::operator==(const member_type&) const):
New.
* src/abg-comparison.cc
(class_diff::{ensure_lookup_tables_populated, report}): Adjust for
the removal of class_decl::member_type::as_type.
* src/abg-dwarf-reader.cc (scope_stack_type): Change this as a
typedef to stack<scope_decl*>.
(current_scope): Change return type from scope_decl_sptr to
scope_decl*.
(insert_decl_into_scope): New.
(build_namespace_decl_and_add_to_ir): Use insert_decl_into_scope
in lieu of add_decl_to_scope.
(build_class_type_and_add_to_ir): likewise. Link a class
definition to its declaration. Push the current scope on the
scope stack. Use as_non_member_type. Fix setting member types.
(get_scope_for_die): Look through declaration-only classe to get
its definition.
(build_qualified_type, build_pointer_type_def)
(build_reference_type, build_typedef_type, build_var_decl)
(build_function_decl): Use as_non_member_type.
(build_ir_node_from_die): Fix member variable & function adding.
* src/abg-ir.cc (scope_decl::{add_member_decl,
insert_member_decl}): Return the added member.
(add_decl_to_scope): Likewise.
(insert_decl_into_scope): Likewise.
(get_top_most_scope_under): Fix logic.
(get_type_declaration): New overload that return a decl_base*.
(as_non_member_type): New definition.
(class_decl::{get_definition_of_declaration,
set_definition_of_declaration, insert_member_decl}): Likewise.
(class_decl::add_member_decl): Re-write in terms of
class::insert_member_decl.
(class_decl::insert_member_type): New definition.
(class_decl::add_member_type): Re-write in terms of
class_decl::insert_member_type.
(class_decl::remove_member_type): Update for the
class_decl::member_type::as_type removal.
(class_decl::{add_data_member, add_member_function,
add_member_function_template, add_member_class_template}): Call
scope_decl::add_member_decl.
(class_decl::member_type::member_type): Update as the type now
virtually inherits from type_base.
(class_decl::member_type::{set,get}_access_specifier): New
definitions.
(class_decl::member_type::get_underlying_type): Likewise.
(class_decl::member_type::set_scope): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
(class_decl::member_type::operator==(const decl_base& other)):
There is no more class_decl::member_type::as_type.
(class_decl::member_type::operator==(const type_base& other)):
New.
(class_decl::member_type::get_pretty_representation): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
* src/abg-reader.cc (build_class_decl): New that add
add_member_decl adds even member types, no need to add it
explicitly anymore.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-13 11:27:47 +00:00
|
|
|
shared_ptr<decl_base>
|
2013-10-19 14:01:59 +00:00
|
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
Fix class scope setting & member type de-serializing from dwarf
* include/abg-fwd.h (add_decl_to_scope, insert_decl_into_scope):
return the decl added to the scope.
(as_non_member_type, get_type_declaration): Declare new entry
points.
* include/abg-ir.h (class decl_base::insert_decl_into_scope):
Update this friend declaration.
(class scope_decl, class_decl): Update the friend add_decl_to_scope
declaration.
(scope_decl::add_member_decl): Return the added decl.
(class_decl_sptr): Move this typedef befoer the class_decl class
declaration.
(class_decl::definition_of_declaration_): New member.
(class_decl::{set_definition_of_declaration,
get_definition_of_declaration}): New accessors.
(class_decl::add_member_decl): Return the added member.
(class_decl::insert_member_type): New member.
(class_decl::member_base::access_specifier): Make this protected.
(class_decl::member_type): Make this inherit from type_vase.
(class_decl::member_type::type_): Remove this member.
(class_decl::member_type::as_type): Remove this accessor.
(class_decl::member_type::operator==(const type_base&)): New.
(class_decl::member_type::operator shared_ptr<type_base>() const):
Remove.
(class_decl::member_type::get_underlying_type): New.
(class_decl::member_type::operator==(const member_type&) const):
New.
* src/abg-comparison.cc
(class_diff::{ensure_lookup_tables_populated, report}): Adjust for
the removal of class_decl::member_type::as_type.
* src/abg-dwarf-reader.cc (scope_stack_type): Change this as a
typedef to stack<scope_decl*>.
(current_scope): Change return type from scope_decl_sptr to
scope_decl*.
(insert_decl_into_scope): New.
(build_namespace_decl_and_add_to_ir): Use insert_decl_into_scope
in lieu of add_decl_to_scope.
(build_class_type_and_add_to_ir): likewise. Link a class
definition to its declaration. Push the current scope on the
scope stack. Use as_non_member_type. Fix setting member types.
(get_scope_for_die): Look through declaration-only classe to get
its definition.
(build_qualified_type, build_pointer_type_def)
(build_reference_type, build_typedef_type, build_var_decl)
(build_function_decl): Use as_non_member_type.
(build_ir_node_from_die): Fix member variable & function adding.
* src/abg-ir.cc (scope_decl::{add_member_decl,
insert_member_decl}): Return the added member.
(add_decl_to_scope): Likewise.
(insert_decl_into_scope): Likewise.
(get_top_most_scope_under): Fix logic.
(get_type_declaration): New overload that return a decl_base*.
(as_non_member_type): New definition.
(class_decl::{get_definition_of_declaration,
set_definition_of_declaration, insert_member_decl}): Likewise.
(class_decl::add_member_decl): Re-write in terms of
class::insert_member_decl.
(class_decl::insert_member_type): New definition.
(class_decl::add_member_type): Re-write in terms of
class_decl::insert_member_type.
(class_decl::remove_member_type): Update for the
class_decl::member_type::as_type removal.
(class_decl::{add_data_member, add_member_function,
add_member_function_template, add_member_class_template}): Call
scope_decl::add_member_decl.
(class_decl::member_type::member_type): Update as the type now
virtually inherits from type_base.
(class_decl::member_type::{set,get}_access_specifier): New
definitions.
(class_decl::member_type::get_underlying_type): Likewise.
(class_decl::member_type::set_scope): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
(class_decl::member_type::operator==(const decl_base& other)):
There is no more class_decl::member_type::as_type.
(class_decl::member_type::operator==(const type_base& other)):
New.
(class_decl::member_type::get_pretty_representation): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
* src/abg-reader.cc (build_class_decl): New that add
add_member_decl adds even member types, no need to add it
explicitly anymore.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-13 11:27:47 +00:00
|
|
|
shared_ptr<decl_base>
|
2013-10-19 14:01:59 +00:00
|
|
|
add_decl_to_scope(shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
Fix class scope setting & member type de-serializing from dwarf
* include/abg-fwd.h (add_decl_to_scope, insert_decl_into_scope):
return the decl added to the scope.
(as_non_member_type, get_type_declaration): Declare new entry
points.
* include/abg-ir.h (class decl_base::insert_decl_into_scope):
Update this friend declaration.
(class scope_decl, class_decl): Update the friend add_decl_to_scope
declaration.
(scope_decl::add_member_decl): Return the added decl.
(class_decl_sptr): Move this typedef befoer the class_decl class
declaration.
(class_decl::definition_of_declaration_): New member.
(class_decl::{set_definition_of_declaration,
get_definition_of_declaration}): New accessors.
(class_decl::add_member_decl): Return the added member.
(class_decl::insert_member_type): New member.
(class_decl::member_base::access_specifier): Make this protected.
(class_decl::member_type): Make this inherit from type_vase.
(class_decl::member_type::type_): Remove this member.
(class_decl::member_type::as_type): Remove this accessor.
(class_decl::member_type::operator==(const type_base&)): New.
(class_decl::member_type::operator shared_ptr<type_base>() const):
Remove.
(class_decl::member_type::get_underlying_type): New.
(class_decl::member_type::operator==(const member_type&) const):
New.
* src/abg-comparison.cc
(class_diff::{ensure_lookup_tables_populated, report}): Adjust for
the removal of class_decl::member_type::as_type.
* src/abg-dwarf-reader.cc (scope_stack_type): Change this as a
typedef to stack<scope_decl*>.
(current_scope): Change return type from scope_decl_sptr to
scope_decl*.
(insert_decl_into_scope): New.
(build_namespace_decl_and_add_to_ir): Use insert_decl_into_scope
in lieu of add_decl_to_scope.
(build_class_type_and_add_to_ir): likewise. Link a class
definition to its declaration. Push the current scope on the
scope stack. Use as_non_member_type. Fix setting member types.
(get_scope_for_die): Look through declaration-only classe to get
its definition.
(build_qualified_type, build_pointer_type_def)
(build_reference_type, build_typedef_type, build_var_decl)
(build_function_decl): Use as_non_member_type.
(build_ir_node_from_die): Fix member variable & function adding.
* src/abg-ir.cc (scope_decl::{add_member_decl,
insert_member_decl}): Return the added member.
(add_decl_to_scope): Likewise.
(insert_decl_into_scope): Likewise.
(get_top_most_scope_under): Fix logic.
(get_type_declaration): New overload that return a decl_base*.
(as_non_member_type): New definition.
(class_decl::{get_definition_of_declaration,
set_definition_of_declaration, insert_member_decl}): Likewise.
(class_decl::add_member_decl): Re-write in terms of
class::insert_member_decl.
(class_decl::insert_member_type): New definition.
(class_decl::add_member_type): Re-write in terms of
class_decl::insert_member_type.
(class_decl::remove_member_type): Update for the
class_decl::member_type::as_type removal.
(class_decl::{add_data_member, add_member_function,
add_member_function_template, add_member_class_template}): Call
scope_decl::add_member_decl.
(class_decl::member_type::member_type): Update as the type now
virtually inherits from type_base.
(class_decl::member_type::{set,get}_access_specifier): New
definitions.
(class_decl::member_type::get_underlying_type): Likewise.
(class_decl::member_type::set_scope): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
(class_decl::member_type::operator==(const decl_base& other)):
There is no more class_decl::member_type::as_type.
(class_decl::member_type::operator==(const type_base& other)):
New.
(class_decl::member_type::get_pretty_representation): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
* src/abg-reader.cc (build_class_decl): New that add
add_member_decl adds even member types, no need to add it
explicitly anymore.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-13 11:27:47 +00:00
|
|
|
shared_ptr<decl_base>
|
2013-12-12 14:40:52 +00:00
|
|
|
insert_decl_into_scope(shared_ptr<decl_base>,
|
|
|
|
vector<shared_ptr<decl_base> >::iterator,
|
|
|
|
scope_decl*);
|
2013-12-11 19:28:18 +00:00
|
|
|
|
Fix class scope setting & member type de-serializing from dwarf
* include/abg-fwd.h (add_decl_to_scope, insert_decl_into_scope):
return the decl added to the scope.
(as_non_member_type, get_type_declaration): Declare new entry
points.
* include/abg-ir.h (class decl_base::insert_decl_into_scope):
Update this friend declaration.
(class scope_decl, class_decl): Update the friend add_decl_to_scope
declaration.
(scope_decl::add_member_decl): Return the added decl.
(class_decl_sptr): Move this typedef befoer the class_decl class
declaration.
(class_decl::definition_of_declaration_): New member.
(class_decl::{set_definition_of_declaration,
get_definition_of_declaration}): New accessors.
(class_decl::add_member_decl): Return the added member.
(class_decl::insert_member_type): New member.
(class_decl::member_base::access_specifier): Make this protected.
(class_decl::member_type): Make this inherit from type_vase.
(class_decl::member_type::type_): Remove this member.
(class_decl::member_type::as_type): Remove this accessor.
(class_decl::member_type::operator==(const type_base&)): New.
(class_decl::member_type::operator shared_ptr<type_base>() const):
Remove.
(class_decl::member_type::get_underlying_type): New.
(class_decl::member_type::operator==(const member_type&) const):
New.
* src/abg-comparison.cc
(class_diff::{ensure_lookup_tables_populated, report}): Adjust for
the removal of class_decl::member_type::as_type.
* src/abg-dwarf-reader.cc (scope_stack_type): Change this as a
typedef to stack<scope_decl*>.
(current_scope): Change return type from scope_decl_sptr to
scope_decl*.
(insert_decl_into_scope): New.
(build_namespace_decl_and_add_to_ir): Use insert_decl_into_scope
in lieu of add_decl_to_scope.
(build_class_type_and_add_to_ir): likewise. Link a class
definition to its declaration. Push the current scope on the
scope stack. Use as_non_member_type. Fix setting member types.
(get_scope_for_die): Look through declaration-only classe to get
its definition.
(build_qualified_type, build_pointer_type_def)
(build_reference_type, build_typedef_type, build_var_decl)
(build_function_decl): Use as_non_member_type.
(build_ir_node_from_die): Fix member variable & function adding.
* src/abg-ir.cc (scope_decl::{add_member_decl,
insert_member_decl}): Return the added member.
(add_decl_to_scope): Likewise.
(insert_decl_into_scope): Likewise.
(get_top_most_scope_under): Fix logic.
(get_type_declaration): New overload that return a decl_base*.
(as_non_member_type): New definition.
(class_decl::{get_definition_of_declaration,
set_definition_of_declaration, insert_member_decl}): Likewise.
(class_decl::add_member_decl): Re-write in terms of
class::insert_member_decl.
(class_decl::insert_member_type): New definition.
(class_decl::add_member_type): Re-write in terms of
class_decl::insert_member_type.
(class_decl::remove_member_type): Update for the
class_decl::member_type::as_type removal.
(class_decl::{add_data_member, add_member_function,
add_member_function_template, add_member_class_template}): Call
scope_decl::add_member_decl.
(class_decl::member_type::member_type): Update as the type now
virtually inherits from type_base.
(class_decl::member_type::{set,get}_access_specifier): New
definitions.
(class_decl::member_type::get_underlying_type): Likewise.
(class_decl::member_type::set_scope): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
(class_decl::member_type::operator==(const decl_base& other)):
There is no more class_decl::member_type::as_type.
(class_decl::member_type::operator==(const type_base& other)):
New.
(class_decl::member_type::get_pretty_representation): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
* src/abg-reader.cc (build_class_decl): New that add
add_member_decl adds even member types, no need to add it
explicitly anymore.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-13 11:27:47 +00:00
|
|
|
shared_ptr<decl_base>
|
2013-12-12 14:40:52 +00:00
|
|
|
insert_decl_into_scope(shared_ptr<decl_base>,
|
|
|
|
vector<shared_ptr<decl_base> >::iterator,
|
|
|
|
shared_ptr<scope_decl>);
|
|
|
|
|
Use the same representation for member and non-member types
* include/abg-fwd.h (is_at_class_scope): Add new oveloads.
(as_non_member_type, as_non_member_class_decl): Remove.
(has_scope, is_member_decl, is_member_type): New function
declarations. (get_member_is_static, set_member_is_static):
Likewise. * include/abg-ir.h (enum access_specifier): Move to
the abigail:: namespace, from ...
(class_decl::access_specifier): ... here. (class
context_rel): New type. (decl_base::hash_as_member): New
hasher. (decl_base::context_): Change the type of this to
context_rel_sptr. (decl_base::get_context_rel): New protected
getter. (decl_base::get_scope): Move this out-of-line.
(class_decl::member_type): Remove.
(class_decl::member_types): Adjust this typedef.
(class_decl::{insert,add}_member_type): Make these take a
type_base_sptr now. (class_decl::add_member_type): Change the
overload that returned a member_type to return a
type_base_sptr. (get_member_access_specifier,
set_member_access_specifier): New function declarations. *
include/abg-comparison.h (class member_type_diff): Remove.
(compute_diff): Remove the overload for member_type_diff. *
src/abg-comparison.cc (compute_diff_for_types): Adjust for the
removal of class_decl::member_type.
(maybe_report_diff_for_class_members): New static function.
(report_name_size_and_alignment_changes): Do not report a name
change just because of a struct -> class change. ({var_diff,
enum_diff, function_decl_diff}::report): Use the new
maybe_report_diff_for_class_members. (class_diff::report):
Adjust for the removal of class_decl::member_type. Use the
new maybe_report_diff_for_class_members. (class member_diff):
Remove. * src/abg-dwarf-reader.cc (die_access_specifier)
(get_scope_for_die, build_translation_unit_and_add_to_ir)
(build_class_type_and_add_to_ir, build_function_decl)
(build_ir_node_from_die): Adjust. * abg-hash.cc (struct
decl_base::hash_as_member): Define. ({scope_type_decl,
enum_type_decl, typedef_decl}::hash::operator()): Use the
decl_base::hash_as_member.
* src/abg-ir.cc (decl_base::decl_base): Adjust.
(decl_base::get_scope): New out-of-line getter.
(decl_base::{operator==, set_scope): Adjust.
(has_scope, is_member_decl, is_member_type)
(get_member_access_specifier, set_member_access_specifier)
(get_member_is_static, set_member_is_static, is_at_class_scope):
New function definitions.
(as_non_member_type, as_non_member_class_decl): Remove.
(get_node_name): Adjust.
(class_decl::{class_decl, set_earlier_declaration,
insert_member_decl, insert_member_type, add_member_type):
Likewise.
(class_decl::member_type::*) Remove.
* src/abg-reader.cc (read_access, build_qualified_type_decl)
(build_reference_type_def, build_typedef_decl)
(build_class_decl): Adjust.
* src/abg-writer.cc (write_access, write_member_type)
(write_class_decl): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-13 10:13:54 +00:00
|
|
|
bool
|
|
|
|
has_scope(const decl_base&);
|
|
|
|
|
|
|
|
bool
|
|
|
|
has_scope(const shared_ptr<decl_base>);
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_member_decl(const shared_ptr<decl_base>);
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_member_decl(const decl_base*);
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_member_decl(const decl_base&);
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_member_type(const shared_ptr<type_base>);
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_member_type(const shared_ptr<decl_base>);
|
|
|
|
|
Prune types that are not ref'ed by public decls
* include/abg-fwd.h (remove_decl_from_scope): Declare new
function.
* include/abg-ir.h (type_base_sptr, decl_base_sptr): Move these
convenience typedef before the translation_unit declaration.
(translation_unit::{mark_type_as_used, prune_unused_types}):
Declare new methods.
(decl_base::remove_member_decl): Likewise.
(class_decl::{remove_member_decl, remove_member_type): Likewise.
* src/abg-dwarf-reader.cc (die_decl_map_type): Change this map
type so that the value is now a DIE offset, rather than a DIE.
This is because many times the lifetime of DIEs is shorter than
the one of the reader_context. Also, the die offset uniquely
designates a physical DIE even if several different instances of
logical DIE might point to it.
(struct die_hash): Remove this as it's useless now that we store
DIE offsets in the map.
(build_translation_unit): Call build_ir_node_from_die w/o setting
the called_from_public_decl flag. Prune the types that are not
used by any public decls.
(build_namespace_decl_and_add_to_ir): all build_ir_node_from_die
w/o setting the called_from_public_decl flag.
(build_ir_node_from_die): Change the only_public_decl flag into a
called_from_public_decl flag. Mark types used by public decls as
such. Adjust for the parm changes of build_qualified_type
build_pointer_type_def, build_reference_type, and
build_typedef_type.
(build_qualified_type, build_pointer_type_def)
(build_reference_type, build_typedef_type): Take a new
called_from_public_decl. Pass it to build_ir_node_from_die.
(build_var_decl): Call build_ir_node_from_die with the
called_from_public_decl flag set to true to flag the types
referenced by this variable as being used.
(build_function_decl): Take a called_from_public_decl flag as
well, as this function can now call build_function_decl itself to
build a function decl out of the value of the DW_AT_specification
attribute, for DIEs representing function definitions. Also, flag
the types referenced by public functions are being used.
* src/abg-ir.cc (translation_unit::priv::used_types_): New map for
the used types.
(translation_unit::{mark_type_as_used, prune_unused_types}):
Define new methods.
(scope_decl::remove_member_decl): Likewise.
(remove_decl_from_scope): Define new function.
(class_decl::{remove_member_decl, remove_member_type}): Define new
methods.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-12-13 16:30:41 +00:00
|
|
|
void
|
|
|
|
remove_decl_from_scope(shared_ptr<decl_base>);
|
|
|
|
|
Use the same representation for member and non-member types
* include/abg-fwd.h (is_at_class_scope): Add new oveloads.
(as_non_member_type, as_non_member_class_decl): Remove.
(has_scope, is_member_decl, is_member_type): New function
declarations. (get_member_is_static, set_member_is_static):
Likewise. * include/abg-ir.h (enum access_specifier): Move to
the abigail:: namespace, from ...
(class_decl::access_specifier): ... here. (class
context_rel): New type. (decl_base::hash_as_member): New
hasher. (decl_base::context_): Change the type of this to
context_rel_sptr. (decl_base::get_context_rel): New protected
getter. (decl_base::get_scope): Move this out-of-line.
(class_decl::member_type): Remove.
(class_decl::member_types): Adjust this typedef.
(class_decl::{insert,add}_member_type): Make these take a
type_base_sptr now. (class_decl::add_member_type): Change the
overload that returned a member_type to return a
type_base_sptr. (get_member_access_specifier,
set_member_access_specifier): New function declarations. *
include/abg-comparison.h (class member_type_diff): Remove.
(compute_diff): Remove the overload for member_type_diff. *
src/abg-comparison.cc (compute_diff_for_types): Adjust for the
removal of class_decl::member_type.
(maybe_report_diff_for_class_members): New static function.
(report_name_size_and_alignment_changes): Do not report a name
change just because of a struct -> class change. ({var_diff,
enum_diff, function_decl_diff}::report): Use the new
maybe_report_diff_for_class_members. (class_diff::report):
Adjust for the removal of class_decl::member_type. Use the
new maybe_report_diff_for_class_members. (class member_diff):
Remove. * src/abg-dwarf-reader.cc (die_access_specifier)
(get_scope_for_die, build_translation_unit_and_add_to_ir)
(build_class_type_and_add_to_ir, build_function_decl)
(build_ir_node_from_die): Adjust. * abg-hash.cc (struct
decl_base::hash_as_member): Define. ({scope_type_decl,
enum_type_decl, typedef_decl}::hash::operator()): Use the
decl_base::hash_as_member.
* src/abg-ir.cc (decl_base::decl_base): Adjust.
(decl_base::get_scope): New out-of-line getter.
(decl_base::{operator==, set_scope): Adjust.
(has_scope, is_member_decl, is_member_type)
(get_member_access_specifier, set_member_access_specifier)
(get_member_is_static, set_member_is_static, is_at_class_scope):
New function definitions.
(as_non_member_type, as_non_member_class_decl): Remove.
(get_node_name): Adjust.
(class_decl::{class_decl, set_earlier_declaration,
insert_member_decl, insert_member_type, add_member_type):
Likewise.
(class_decl::member_type::*) Remove.
* src/abg-reader.cc (read_access, build_qualified_type_decl)
(build_reference_type_def, build_typedef_decl)
(build_class_decl): Adjust.
* src/abg-writer.cc (write_access, write_member_type)
(write_class_decl): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-13 10:13:54 +00:00
|
|
|
bool
|
|
|
|
get_member_is_static(const decl_base&);
|
|
|
|
|
Get rid of class_decl::data_member
* include/abg-fwd.h (has_scope): Delete the overloads for
type_base.
(get_member_is_static): Add an overload for decl_base*.
({is,get,set}_data_member,{get_,set}_data_member_is_laid_out)
({get,set}_data_member_offset): New access declarations.
* include/abg-ir.h (class context_rel): Move up.
(decl_base::set_context_rel): New definition.
(class dm_context_rel): New type.
(decl_base::hash_as_member): Remove.
(var_decl::set_scope): Declare new virtual member.
(class_decl::data_member): Remove.
(ir_node_visitor::visit): Remove the overload for
class_decl::data_member.
(represent_data_member): Remove the represent overload for
class_decl::data_member into this. Make it take a var_decl.
(represent): Change the overload that takes two
class_decl::data_member take two var_decl. And adjust it.
(class_diff::report): Adjust.
* src/abg-corpus.cc (symtab_build_visitor_type::visit): Remove the
overload that takes a class_decl::data_member*. Adjust the
overload that takes a var_decl to recognize (static) data members.
* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir)
(build_class_type_and_add_to_ir, build_ir_node_from_die):
Adjust.
* src/abg-hash.cc (var_decl::hash::operator()): Adjust.
(class_decl::data_member::hash::operator()): Remove.
(decl_base::hash::operator()): Take the context relationship in
account here.
(decl_base::hash_as_member::operator()): Remove.
({enum_type_decl,typedef_decl}::hash::operator()): Adjust.
(class_decl::member_function::hash::operator()): Adjust.
(type_base::dynamic_hash::operator()): Adjust.
* src/abg-ir.cc (dm_context_rel::~dm_context_rel): New definition.
(has_scope): Remove overload for type_base.
(get_member_is_static): New overload for decl_base*.
(is_data_member): New function definition.
({get,set}_data_member_{offset,is_laid_out}): Define new
accessors.
(var_decl::set_scope): Define new member function. Make this set
a dm_context_rel as the context relationship.
(var_decl::operator==): Adjust to take in account the new data
member relationship.
(class_decl::class_decl): Adjust.
(class_decl::insert_member_decl): Adjust.
(class_decl::add_data_member): Remove the overload for
class_decl::data_member.
(class_decl::add_data_member): Adjust the overload for var_decl.
(operator==): Remove overload for class_decl::data_member*.
(class_decl::data_member::operator==): Likewise.
(ir_node_visitor::visit): Remove overload for
class_decl::data_member.
* src/abg-writer.cc (write_layout_offset, write_class_decl):
Adjust.
* tests/data/test-read-write/test20.xml: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-19 19:36:55 +00:00
|
|
|
bool
|
|
|
|
get_member_is_static(const decl_base*);
|
|
|
|
|
Use the same representation for member and non-member types
* include/abg-fwd.h (is_at_class_scope): Add new oveloads.
(as_non_member_type, as_non_member_class_decl): Remove.
(has_scope, is_member_decl, is_member_type): New function
declarations. (get_member_is_static, set_member_is_static):
Likewise. * include/abg-ir.h (enum access_specifier): Move to
the abigail:: namespace, from ...
(class_decl::access_specifier): ... here. (class
context_rel): New type. (decl_base::hash_as_member): New
hasher. (decl_base::context_): Change the type of this to
context_rel_sptr. (decl_base::get_context_rel): New protected
getter. (decl_base::get_scope): Move this out-of-line.
(class_decl::member_type): Remove.
(class_decl::member_types): Adjust this typedef.
(class_decl::{insert,add}_member_type): Make these take a
type_base_sptr now. (class_decl::add_member_type): Change the
overload that returned a member_type to return a
type_base_sptr. (get_member_access_specifier,
set_member_access_specifier): New function declarations. *
include/abg-comparison.h (class member_type_diff): Remove.
(compute_diff): Remove the overload for member_type_diff. *
src/abg-comparison.cc (compute_diff_for_types): Adjust for the
removal of class_decl::member_type.
(maybe_report_diff_for_class_members): New static function.
(report_name_size_and_alignment_changes): Do not report a name
change just because of a struct -> class change. ({var_diff,
enum_diff, function_decl_diff}::report): Use the new
maybe_report_diff_for_class_members. (class_diff::report):
Adjust for the removal of class_decl::member_type. Use the
new maybe_report_diff_for_class_members. (class member_diff):
Remove. * src/abg-dwarf-reader.cc (die_access_specifier)
(get_scope_for_die, build_translation_unit_and_add_to_ir)
(build_class_type_and_add_to_ir, build_function_decl)
(build_ir_node_from_die): Adjust. * abg-hash.cc (struct
decl_base::hash_as_member): Define. ({scope_type_decl,
enum_type_decl, typedef_decl}::hash::operator()): Use the
decl_base::hash_as_member.
* src/abg-ir.cc (decl_base::decl_base): Adjust.
(decl_base::get_scope): New out-of-line getter.
(decl_base::{operator==, set_scope): Adjust.
(has_scope, is_member_decl, is_member_type)
(get_member_access_specifier, set_member_access_specifier)
(get_member_is_static, set_member_is_static, is_at_class_scope):
New function definitions.
(as_non_member_type, as_non_member_class_decl): Remove.
(get_node_name): Adjust.
(class_decl::{class_decl, set_earlier_declaration,
insert_member_decl, insert_member_type, add_member_type):
Likewise.
(class_decl::member_type::*) Remove.
* src/abg-reader.cc (read_access, build_qualified_type_decl)
(build_reference_type_def, build_typedef_decl)
(build_class_decl): Adjust.
* src/abg-writer.cc (write_access, write_member_type)
(write_class_decl): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-13 10:13:54 +00:00
|
|
|
bool
|
|
|
|
get_member_is_static(const shared_ptr<decl_base>);
|
|
|
|
|
|
|
|
void
|
|
|
|
set_member_is_static(decl_base&,
|
|
|
|
bool);
|
|
|
|
|
|
|
|
void
|
|
|
|
set_member_is_static(shared_ptr<decl_base>,
|
|
|
|
bool);
|
|
|
|
|
Get rid of class_decl::data_member
* include/abg-fwd.h (has_scope): Delete the overloads for
type_base.
(get_member_is_static): Add an overload for decl_base*.
({is,get,set}_data_member,{get_,set}_data_member_is_laid_out)
({get,set}_data_member_offset): New access declarations.
* include/abg-ir.h (class context_rel): Move up.
(decl_base::set_context_rel): New definition.
(class dm_context_rel): New type.
(decl_base::hash_as_member): Remove.
(var_decl::set_scope): Declare new virtual member.
(class_decl::data_member): Remove.
(ir_node_visitor::visit): Remove the overload for
class_decl::data_member.
(represent_data_member): Remove the represent overload for
class_decl::data_member into this. Make it take a var_decl.
(represent): Change the overload that takes two
class_decl::data_member take two var_decl. And adjust it.
(class_diff::report): Adjust.
* src/abg-corpus.cc (symtab_build_visitor_type::visit): Remove the
overload that takes a class_decl::data_member*. Adjust the
overload that takes a var_decl to recognize (static) data members.
* src/abg-dwarf-reader.cc (build_translation_unit_and_add_to_ir)
(build_class_type_and_add_to_ir, build_ir_node_from_die):
Adjust.
* src/abg-hash.cc (var_decl::hash::operator()): Adjust.
(class_decl::data_member::hash::operator()): Remove.
(decl_base::hash::operator()): Take the context relationship in
account here.
(decl_base::hash_as_member::operator()): Remove.
({enum_type_decl,typedef_decl}::hash::operator()): Adjust.
(class_decl::member_function::hash::operator()): Adjust.
(type_base::dynamic_hash::operator()): Adjust.
* src/abg-ir.cc (dm_context_rel::~dm_context_rel): New definition.
(has_scope): Remove overload for type_base.
(get_member_is_static): New overload for decl_base*.
(is_data_member): New function definition.
({get,set}_data_member_{offset,is_laid_out}): Define new
accessors.
(var_decl::set_scope): Define new member function. Make this set
a dm_context_rel as the context relationship.
(var_decl::operator==): Adjust to take in account the new data
member relationship.
(class_decl::class_decl): Adjust.
(class_decl::insert_member_decl): Adjust.
(class_decl::add_data_member): Remove the overload for
class_decl::data_member.
(class_decl::add_data_member): Adjust the overload for var_decl.
(operator==): Remove overload for class_decl::data_member*.
(class_decl::data_member::operator==): Likewise.
(ir_node_visitor::visit): Remove overload for
class_decl::data_member.
* src/abg-writer.cc (write_layout_offset, write_class_decl):
Adjust.
* tests/data/test-read-write/test20.xml: Adjust.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-03-19 19:36:55 +00:00
|
|
|
bool
|
|
|
|
is_data_member(const var_decl&);
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_data_member(const var_decl*);
|
|
|
|
|
|
|
|
bool
|
|
|
|
is_data_member(const shared_ptr<var_decl>);
|
|
|
|
|
|
|
|
void
|
|
|
|
set_data_member_offset(shared_ptr<var_decl>, size_t);
|
|
|
|
|
|
|
|
size_t
|
|
|
|
get_data_member_offset(const var_decl&);
|
|
|
|
|
|
|
|
size_t
|
|
|
|
get_data_member_offset(const shared_ptr<var_decl>);
|
|
|
|
|
|
|
|
void
|
|
|
|
set_data_member_is_laid_out(shared_ptr<var_decl>, bool);
|
|
|
|
|
|
|
|
bool
|
|
|
|
get_data_member_is_laid_out(const var_decl&);
|
|
|
|
|
|
|
|
bool
|
|
|
|
get_data_member_is_laid_out(const shared_ptr<var_decl>);
|
|
|
|
|
2013-12-12 14:40:52 +00:00
|
|
|
const global_scope*
|
|
|
|
get_global_scope(const decl_base* decl);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
2013-12-11 19:28:18 +00:00
|
|
|
translation_unit*
|
|
|
|
get_translation_unit(decl_base* decl);
|
|
|
|
|
2013-10-10 08:11:35 +00:00
|
|
|
translation_unit*
|
2013-10-19 14:01:59 +00:00
|
|
|
get_translation_unit(const shared_ptr<decl_base>);
|
2013-10-10 08:11:35 +00:00
|
|
|
|
Support diff/reporting for functions & better diff/report in general
* include/abg-ir.h ({decl_base, class_decl,
function_decl}::get_pretty_representation): New virtual member to
get a pretty string name for decls & types.
(class_decl::parameter): Add an index to the parameter type.
(class_decl::parameter::parameter): Update the constructor for the
change above.
(class_decl::parameter::{get_index, set_index}): Accessors for the
new index.
(class_decl::parameter::operator==): Take in account the index.
(function_type::append_parameter): Set the index of the parameter
here.
* include/abg-fwd.h (get_type_name): New declaration.
* src/abg-ir.cc (get_type_name): New definition.
({decl_base, function_decl,
class_decl}::get_pretty_representation): New implementations.
(method_type::set_class_type): Update this to set function
parameter's index by default.
(function_decl::append_parameters): Use the append_parameter
method from function_type.
* include/abg-comparison.h (class function_decl_diff): New type
declaration.
* src/abg-comparison.cc (compute_diff_for_decls, compute_diff):
New definitions.
({pointer_diff, class_diff, scope_diff}::report): Use the new
get_pretty_representation. Output a prettier report.
(function_decl_diff::priv): New type.
(function_decl_diff::{deleted_parameter_at, inserted_parameter_at,
ensure_lookup_tables_populated, function_decl_diff,
first_function_decl, second_function_decl, changed_parms,
removed_parms, added_parms, length, report}): New member function
definitions.
* src/abg-hash.cc (function_decl::parameter::hash): Update this to
take the index in account.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-10-19 14:33:40 +00:00
|
|
|
string
|
|
|
|
get_type_name(const shared_ptr<type_base>);
|
|
|
|
|
Fix class scope setting & member type de-serializing from dwarf
* include/abg-fwd.h (add_decl_to_scope, insert_decl_into_scope):
return the decl added to the scope.
(as_non_member_type, get_type_declaration): Declare new entry
points.
* include/abg-ir.h (class decl_base::insert_decl_into_scope):
Update this friend declaration.
(class scope_decl, class_decl): Update the friend add_decl_to_scope
declaration.
(scope_decl::add_member_decl): Return the added decl.
(class_decl_sptr): Move this typedef befoer the class_decl class
declaration.
(class_decl::definition_of_declaration_): New member.
(class_decl::{set_definition_of_declaration,
get_definition_of_declaration}): New accessors.
(class_decl::add_member_decl): Return the added member.
(class_decl::insert_member_type): New member.
(class_decl::member_base::access_specifier): Make this protected.
(class_decl::member_type): Make this inherit from type_vase.
(class_decl::member_type::type_): Remove this member.
(class_decl::member_type::as_type): Remove this accessor.
(class_decl::member_type::operator==(const type_base&)): New.
(class_decl::member_type::operator shared_ptr<type_base>() const):
Remove.
(class_decl::member_type::get_underlying_type): New.
(class_decl::member_type::operator==(const member_type&) const):
New.
* src/abg-comparison.cc
(class_diff::{ensure_lookup_tables_populated, report}): Adjust for
the removal of class_decl::member_type::as_type.
* src/abg-dwarf-reader.cc (scope_stack_type): Change this as a
typedef to stack<scope_decl*>.
(current_scope): Change return type from scope_decl_sptr to
scope_decl*.
(insert_decl_into_scope): New.
(build_namespace_decl_and_add_to_ir): Use insert_decl_into_scope
in lieu of add_decl_to_scope.
(build_class_type_and_add_to_ir): likewise. Link a class
definition to its declaration. Push the current scope on the
scope stack. Use as_non_member_type. Fix setting member types.
(get_scope_for_die): Look through declaration-only classe to get
its definition.
(build_qualified_type, build_pointer_type_def)
(build_reference_type, build_typedef_type, build_var_decl)
(build_function_decl): Use as_non_member_type.
(build_ir_node_from_die): Fix member variable & function adding.
* src/abg-ir.cc (scope_decl::{add_member_decl,
insert_member_decl}): Return the added member.
(add_decl_to_scope): Likewise.
(insert_decl_into_scope): Likewise.
(get_top_most_scope_under): Fix logic.
(get_type_declaration): New overload that return a decl_base*.
(as_non_member_type): New definition.
(class_decl::{get_definition_of_declaration,
set_definition_of_declaration, insert_member_decl}): Likewise.
(class_decl::add_member_decl): Re-write in terms of
class::insert_member_decl.
(class_decl::insert_member_type): New definition.
(class_decl::add_member_type): Re-write in terms of
class_decl::insert_member_type.
(class_decl::remove_member_type): Update for the
class_decl::member_type::as_type removal.
(class_decl::{add_data_member, add_member_function,
add_member_function_template, add_member_class_template}): Call
scope_decl::add_member_decl.
(class_decl::member_type::member_type): Update as the type now
virtually inherits from type_base.
(class_decl::member_type::{set,get}_access_specifier): New
definitions.
(class_decl::member_type::get_underlying_type): Likewise.
(class_decl::member_type::set_scope): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
(class_decl::member_type::operator==(const decl_base& other)):
There is no more class_decl::member_type::as_type.
(class_decl::member_type::operator==(const type_base& other)):
New.
(class_decl::member_type::get_pretty_representation): Update wrt
class_decl::member_type::as_type -> get_underlying_type rename.
* src/abg-reader.cc (build_class_decl): New that add
add_member_decl adds even member types, no need to add it
explicitly anymore.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-01-13 11:27:47 +00:00
|
|
|
const decl_base*
|
|
|
|
get_type_declaration(const type_base*);
|
|
|
|
|
|
|
|
decl_base*
|
|
|
|
get_type_declaration(type_base*);
|
|
|
|
|
Avoid missing member types while reading bi files
* include/abg-fwd.h (get_type_declaration): Declare function.
* include/abg-ir.h (class decl_base): Add class_decl as a friend.
This to be able to call decl_base::set_scope from class_decl.
(scope_decl::add_member_decl): Make this virtual protected, so
that it can be called (virtually) from e.g, class_decl.
(type_decl_sptr, typedef_decl_sptr): New convenience typedefs.
(class_decl::add_member_decl): New virtual overload for
scope_decl::add_member_decl.
(class_decl::{add_member_type, add_data_member,
add_member_function}): New overloads.
* src/abg-ir.cc (add_decl_to_scope): Benign style cleanup.
(get_type_declaration): Define new function.
(class_decl::add_member_decl): New method.
(class_decl::add_member_type): Avoid silently added a new member
type when that member type has already been (perhaps
inadvertently) added to a scope already. Rather, put a strict
assert in place there. Also add a new overload that constructs
the member type out of a classic type and adds it to the class.
(class_decl::{add_data_member, add_member_function}): Likewise.
(class_decl::{add_member_function_template,
add_member_class_template}): Avoid silently added a new member
template when that template has already been (perhaps
inadvertently) added to a scope already. Rather, put a strict
assert in place there.
* src/abg-reader.cc (push_decl_to_current_scope): Take a an extra
flag saying if the current decl should be added to the current
scope as well (in addition to being pushed onto the stack of
scopes maintained in the reader context).
(push_and_key_type_decl): Likewise, take that extra flag and pass
it to push_decl_to_current_scope.
(build_function_decl, build_var_decl, build_type_decl)
(build_qualified_type_decl, build_pointer_type_def)
(build_reference_type_def, build_enum_type_decl, build_typedef_decl)
(build_function_tdecl, build_class_tdecl): Likewise.
(build_class_decl): Likewise. When building member data, types,
and functions, make sure /not/ to add the data, type of function to
the current scope before adding it to the class_decl. This was
making the member not being added to the class because it already
had a scope.
(build_type_tparameter, build_type_composition)
(build_non_type_tparameter, build_template_tparameter)
(build_type): Adjust to add the template parm to the current scope
explicitly, like previously.
(handle_type_decl): Use build_type_decl function. Add the
type_decl to the current scope, like previously.
(handle_namespace_decl, handle_qualified_type_decl)
(handle_pointer_type_def, handle_reference_type_def)
(handle_enum_type_decl, handle_typedef_decl, handle_var_decl)
(handle_function_decl, handle_class_decl, handle_function_tdecl)
(handle_class_tdecl): Adjust to add the decl to the current scope,
like previously.
* tests/data/test-read-write/test21.xml: New test input with
member type(def).
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2013-11-19 09:06:04 +00:00
|
|
|
shared_ptr<decl_base>
|
|
|
|
get_type_declaration(const shared_ptr<type_base>);
|
|
|
|
|
2013-12-12 14:40:52 +00:00
|
|
|
const scope_decl*
|
|
|
|
get_top_most_scope_under(const decl_base*,
|
|
|
|
const scope_decl*);
|
|
|
|
|
|
|
|
const scope_decl*
|
|
|
|
get_top_most_scope_under(const shared_ptr<decl_base>,
|
|
|
|
const scope_decl*);
|
|
|
|
|
|
|
|
const scope_decl*
|
|
|
|
get_top_most_scope_under(const shared_ptr<decl_base>,
|
|
|
|
const shared_ptr<scope_decl>);
|
|
|
|
|
Better support of static member variables
* include/abg-fwd.h (fqn_to_components)
(lookup_type_in_translation_unit, demangle_cplus_mangled_name):
Declare new public entry points
* src/abg-comparison.cc (corpus_diff::report): Report stuff about
global variables using their mangled name, and demangle them. If
there is no mangled name for the variable, then use its pretty
representation.
(compute_diff): For the corpus overload, compare global variables
using their mangled name, if its available; otherwise, fall back
to using their pretty representation.
* src/abg-corpus.cc (var_comp::operator()(const var_decl*,
const_var_decl*)): Compare variables using their mangled name in
priority. If it's not available then use their pretty
representation.
* src/abg-dwarf-reader.cc
(read_context::var_decls_to_re_add_to_tree): New accessor.
(build_translation_unit_and_add_to_ir): If there is what appears
to be a definition of a static member variable variable -- this is
in case this definition lacks the DW_AT_specification attribute
that links it to the DW_TAG_member or DW_TAG_variable DIE that is
a child of the right class/structure DIE -- that is not at the
right place in the DIE tree, remove it from the its current place
in the tree and try to hang it off of the right DIE. To do this,
de-mangle its mangled name, look at what is supposed to be the
parent class name, look it up in the translation unit IR, and if
found, stick the variable IR node in there, as a static member
variable. If not found, then bad luck.
(build_class_type_and_add_to_ir): Do not try to see if a member
variable is static here as the way I was doing it was unreliable.
Build the data member node directly w/o going through building a
variable node first. Register the data member in the die offset
-> IR node map.
(build_ir_node_from_die): When seeing DW_TAG_variable, look for a
DW_AT_specification attribute. If there is one, then it points to
a the DIE of a data member and means that data member is static.
Flag the IR node of that data member as static thus. Update the
die offset -> IR node map. If there is no DW_AT_specification
attribute or if it doesn't point to a data member DIE, schedule
this variable tag for a stage when after the whole IR is built for
the translation unit, the variable's mangled named is inspected,
its hypothetical parent struct/class is looked up and the variable
IR node is put into the node of the right struct/class IR node.
* src/abg-ir.cc (enum lookup_entity_kind): New.
(fqn_to_components, iterator, lookup_type_in_translation_unit)
(lookup_node_in_translation_unit, lookup_type_in_translation_unit)
(demangle_cplus_mangled_name): New function definitions.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-19 16:48:15 +00:00
|
|
|
void
|
|
|
|
fqn_to_components(const std::string&,
|
|
|
|
std::list<string>&);
|
|
|
|
|
|
|
|
const shared_ptr<decl_base>
|
|
|
|
lookup_type_in_translation_unit(const string&,
|
|
|
|
const translation_unit&);
|
|
|
|
|
|
|
|
const shared_ptr<decl_base>
|
|
|
|
lookup_type_in_translation_unit(const std::list<string>&,
|
|
|
|
const translation_unit&);
|
|
|
|
|
2014-03-12 13:59:45 +00:00
|
|
|
const shared_ptr<decl_base>
|
|
|
|
lookup_type_in_scope(const string&,
|
|
|
|
const shared_ptr<scope_decl>);
|
|
|
|
|
|
|
|
const shared_ptr<decl_base>
|
|
|
|
lookup_type_in_scope(const std::list<string>&,
|
|
|
|
const shared_ptr<scope_decl>);
|
|
|
|
|
|
|
|
const shared_ptr<decl_base>
|
|
|
|
lookup_var_decl_in_scope(const string&,
|
|
|
|
const shared_ptr<scope_decl>);
|
|
|
|
|
|
|
|
const shared_ptr<decl_base>
|
|
|
|
lookup_var_decl_in_scope(const std::list<string>&,
|
|
|
|
const shared_ptr<scope_decl>);
|
|
|
|
|
Better support of static member variables
* include/abg-fwd.h (fqn_to_components)
(lookup_type_in_translation_unit, demangle_cplus_mangled_name):
Declare new public entry points
* src/abg-comparison.cc (corpus_diff::report): Report stuff about
global variables using their mangled name, and demangle them. If
there is no mangled name for the variable, then use its pretty
representation.
(compute_diff): For the corpus overload, compare global variables
using their mangled name, if its available; otherwise, fall back
to using their pretty representation.
* src/abg-corpus.cc (var_comp::operator()(const var_decl*,
const_var_decl*)): Compare variables using their mangled name in
priority. If it's not available then use their pretty
representation.
* src/abg-dwarf-reader.cc
(read_context::var_decls_to_re_add_to_tree): New accessor.
(build_translation_unit_and_add_to_ir): If there is what appears
to be a definition of a static member variable variable -- this is
in case this definition lacks the DW_AT_specification attribute
that links it to the DW_TAG_member or DW_TAG_variable DIE that is
a child of the right class/structure DIE -- that is not at the
right place in the DIE tree, remove it from the its current place
in the tree and try to hang it off of the right DIE. To do this,
de-mangle its mangled name, look at what is supposed to be the
parent class name, look it up in the translation unit IR, and if
found, stick the variable IR node in there, as a static member
variable. If not found, then bad luck.
(build_class_type_and_add_to_ir): Do not try to see if a member
variable is static here as the way I was doing it was unreliable.
Build the data member node directly w/o going through building a
variable node first. Register the data member in the die offset
-> IR node map.
(build_ir_node_from_die): When seeing DW_TAG_variable, look for a
DW_AT_specification attribute. If there is one, then it points to
a the DIE of a data member and means that data member is static.
Flag the IR node of that data member as static thus. Update the
die offset -> IR node map. If there is no DW_AT_specification
attribute or if it doesn't point to a data member DIE, schedule
this variable tag for a stage when after the whole IR is built for
the translation unit, the variable's mangled named is inspected,
its hypothetical parent struct/class is looked up and the variable
IR node is put into the node of the right struct/class IR node.
* src/abg-ir.cc (enum lookup_entity_kind): New.
(fqn_to_components, iterator, lookup_type_in_translation_unit)
(lookup_node_in_translation_unit, lookup_type_in_translation_unit)
(demangle_cplus_mangled_name): New function definitions.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-02-19 16:48:15 +00:00
|
|
|
string
|
|
|
|
demangle_cplus_mangled_name(const string&);
|
|
|
|
|
2013-12-07 07:07:54 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<decl_base>, std::ostream&);
|
|
|
|
|
2013-10-16 20:01:28 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<decl_base>);
|
|
|
|
|
2013-12-07 07:07:54 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<type_base>, std::ostream&);
|
|
|
|
|
2013-10-16 20:01:28 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<type_base>);
|
|
|
|
|
2013-12-07 07:07:54 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<var_decl>, std::ostream&);
|
|
|
|
|
2013-10-16 20:01:28 +00:00
|
|
|
void
|
2013-10-19 14:01:59 +00:00
|
|
|
dump(const shared_ptr<var_decl>);
|
2013-10-16 20:01:28 +00:00
|
|
|
|
2013-12-07 07:07:54 +00:00
|
|
|
void
|
|
|
|
dump(const translation_unit&, std::ostream&);
|
|
|
|
|
2013-10-16 20:01:28 +00:00
|
|
|
void
|
|
|
|
dump(const translation_unit&);
|
|
|
|
|
2013-12-07 07:07:54 +00:00
|
|
|
void
|
|
|
|
dump(const shared_ptr<translation_unit>, std::ostream&);
|
|
|
|
|
|
|
|
void
|
|
|
|
dump(const shared_ptr<translation_unit>);
|
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
} // end namespace abigail
|
|
|
|
#endif // __ABG_IRFWD_H__
|