mirror of
git://sourceware.org/git/libabigail.git
synced 2025-01-27 19:52:52 +00:00
f42a59c3dd
* 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>
251 lines
5.5 KiB
C++
251 lines
5.5 KiB
C++
// -*- 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.
|
|
#include <ostream>
|
|
#include "abg-hash.h"
|
|
|
|
/// Toplevel namespace for libabigail.
|
|
namespace abigail
|
|
{
|
|
/**
|
|
@mainpage libabigail
|
|
|
|
|
|
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:
|
|
git clone git://git.sourceware.org/git/libabigail.git.
|
|
|
|
The mailing list to send messages and patches to is
|
|
libabigail@sourceware.org.
|
|
*/
|
|
|
|
// Inject some types.
|
|
using std::tr1::shared_ptr;
|
|
using std::string;
|
|
using std::vector;
|
|
|
|
// 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;
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope (shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
|
|
|
const global_scope*
|
|
get_global_scope(const shared_ptr<decl_base>);
|
|
|
|
translation_unit*
|
|
get_translation_unit(const shared_ptr<decl_base>);
|
|
|
|
translation_unit*
|
|
get_translation_unit(decl_base*);
|
|
|
|
bool
|
|
is_global_scope(const scope_decl*);
|
|
|
|
bool
|
|
is_global_scope(const shared_ptr<scope_decl>);
|
|
|
|
bool
|
|
is_at_global_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_at_class_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_at_template_scope(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_template_parameter(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_type(const decl_base&);
|
|
|
|
shared_ptr<type_base>
|
|
is_type(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<type_base>
|
|
as_non_member_type(const shared_ptr<type_base>);
|
|
|
|
shared_ptr<type_base>
|
|
as_non_member_type(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_var_decl(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_template_parm_composition_type(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_template_decl(const shared_ptr<decl_base>);
|
|
|
|
bool
|
|
is_function_template_pattern(const shared_ptr<decl_base>);
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
|
|
|
shared_ptr<decl_base>
|
|
add_decl_to_scope(shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
|
|
|
shared_ptr<decl_base>
|
|
insert_decl_into_scope(shared_ptr<decl_base>,
|
|
vector<shared_ptr<decl_base> >::iterator,
|
|
scope_decl*);
|
|
|
|
shared_ptr<decl_base>
|
|
insert_decl_into_scope(shared_ptr<decl_base>,
|
|
vector<shared_ptr<decl_base> >::iterator,
|
|
shared_ptr<scope_decl>);
|
|
|
|
void
|
|
remove_decl_from_scope(shared_ptr<decl_base>);
|
|
|
|
const global_scope*
|
|
get_global_scope(const decl_base* decl);
|
|
|
|
translation_unit*
|
|
get_translation_unit(decl_base* decl);
|
|
|
|
translation_unit*
|
|
get_translation_unit(const shared_ptr<decl_base>);
|
|
|
|
string
|
|
get_type_name(const shared_ptr<type_base>);
|
|
|
|
const decl_base*
|
|
get_type_declaration(const type_base*);
|
|
|
|
decl_base*
|
|
get_type_declaration(type_base*);
|
|
|
|
shared_ptr<decl_base>
|
|
get_type_declaration(const shared_ptr<type_base>);
|
|
|
|
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>);
|
|
|
|
void
|
|
dump(const shared_ptr<decl_base>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<decl_base>);
|
|
|
|
void
|
|
dump(const shared_ptr<type_base>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<type_base>);
|
|
|
|
void
|
|
dump(const shared_ptr<var_decl>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<var_decl>);
|
|
|
|
void
|
|
dump(const translation_unit&, std::ostream&);
|
|
|
|
void
|
|
dump(const translation_unit&);
|
|
|
|
void
|
|
dump(const shared_ptr<translation_unit>, std::ostream&);
|
|
|
|
void
|
|
dump(const shared_ptr<translation_unit>);
|
|
|
|
} // end namespace abigail
|
|
#endif // __ABG_IRFWD_H__
|