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.
|
|
|
|
#include "abg-hash.h"
|
|
|
|
|
|
|
|
/// Toplevel namespace for libabigail.
|
|
|
|
namespace abigail
|
|
|
|
{
|
2013-08-02 23:30:56 +00:00
|
|
|
/**
|
2013-08-21 18:06:57 +00:00
|
|
|
@mainpage libabigail
|
|
|
|
|
|
|
|
|
|
|
|
The GNU Application Binary Interface Generic Analysis and
|
|
|
|
Instrumentation Library.
|
2013-08-02 23:30:56 +00:00
|
|
|
|
|
|
|
This is an interface to the GNU Compiler Collection for the
|
|
|
|
collection and analysis of compiler-generated binaries.
|
|
|
|
|
2013-08-21 18:06:57 +00:00
|
|
|
Checkout out the project homepage <a
|
|
|
|
href="http://sourceware.org/libabigail"> here</a>.
|
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
The current libabigail source code can be checked out with:
|
2013-08-21 18:06:57 +00:00
|
|
|
git clone git://git.sourceware.org/git/libabigail.git.
|
2013-08-02 23:30:56 +00:00
|
|
|
|
|
|
|
The mailing list to send messages and patches to is
|
|
|
|
libabigail@sourceware.org.
|
|
|
|
*/
|
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
// Inject some types.
|
|
|
|
using std::tr1::shared_ptr;
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
// Pull in relational operators.
|
|
|
|
using namespace std::rel_ops;
|
|
|
|
|
2013-08-08 14:56:06 +00:00
|
|
|
// Forward declarations for corpus.
|
2013-08-27 11:27:35 +00:00
|
|
|
|
2013-08-08 14:56:06 +00:00
|
|
|
class corpus;
|
|
|
|
|
|
|
|
// Forward declarations for ir.
|
2013-08-27 11:27:35 +00:00
|
|
|
class location;
|
|
|
|
class location_manager;
|
|
|
|
class translation_unit;
|
2013-08-02 03:16:22 +00:00
|
|
|
class class_decl;
|
2013-08-08 06:54:44 +00:00
|
|
|
class class_tdecl;
|
2013-08-02 03:16:22 +00:00
|
|
|
class decl_base;
|
|
|
|
class enum_type_decl;
|
|
|
|
class function_decl;
|
2013-08-08 06:54:44 +00:00
|
|
|
class function_tdecl;
|
2013-08-02 03:16:22 +00:00
|
|
|
class function_type;
|
|
|
|
class global_scope;
|
2013-09-26 21:33:23 +00:00
|
|
|
class node_visitor;
|
2013-08-02 03:16:22 +00:00
|
|
|
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;
|
2013-08-08 06:54:44 +00:00
|
|
|
class non_type_tparameter;
|
|
|
|
class type_tparameter;
|
|
|
|
class template_tparameter;
|
|
|
|
|
|
|
|
class type_composition;
|
2013-08-02 03:16:22 +00:00
|
|
|
class type_base;
|
|
|
|
class type_decl;
|
|
|
|
class typedef_decl;
|
|
|
|
class var_decl;
|
|
|
|
|
|
|
|
struct type_shared_ptr_equal;
|
2013-08-08 14:56:06 +00:00
|
|
|
struct traversable_base;
|
2013-08-02 03:16:22 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
|
|
|
|
|
|
|
|
void
|
|
|
|
add_decl_to_scope (shared_ptr<decl_base>, shared_ptr<scope_decl>);
|
|
|
|
|
|
|
|
global_scope*
|
|
|
|
get_global_scope(const shared_ptr<decl_base>);
|
|
|
|
|
|
|
|
translation_unit*
|
|
|
|
get_translation_unit(const shared_ptr<decl_base>);
|
2013-08-27 11:55:45 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Tests whether if a given scope is the global scope.
|
|
|
|
///
|
|
|
|
/// @param scpe the scope to consider.
|
|
|
|
///
|
|
|
|
/// @return true iff the current scope is the global one.
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
is_global_scope(const scope_decl* scpe);
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Tests whether if a given scope is the global scope.
|
|
|
|
///
|
|
|
|
/// @param scpe the scope to consider.
|
|
|
|
///
|
|
|
|
/// @return true iff the current scope is the global one.
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
is_global_scope(const shared_ptr<scope_decl> scpe);
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Tests whether a given declaration is at global scope.
|
|
|
|
///
|
|
|
|
/// @param dcl the decl to consider.
|
|
|
|
///
|
|
|
|
/// @return true iff dcl is at global scope.
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
is_at_global_scope(const shared_ptr<decl_base> dcl);
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Tests whether a given decl is at class scope.
|
|
|
|
///
|
|
|
|
/// @param dcl the decl to consider.
|
|
|
|
///
|
|
|
|
/// @return true iff dcl is at class scope.
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
is_at_class_scope(const shared_ptr<decl_base> dcl);
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Tests whether a given decl is at template scope.
|
|
|
|
///
|
|
|
|
/// Note that only template parameters , types that are compositions,
|
|
|
|
/// and template patterns (function or class) can be at template scope.
|
|
|
|
///
|
|
|
|
/// @param dcl the decl to consider.
|
|
|
|
///
|
|
|
|
/// @return true iff the dcl is at template scope.
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
is_at_template_scope(const shared_ptr<decl_base> dcl);
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Tests whether a decl is a template parameter.
|
|
|
|
///
|
|
|
|
/// @param dcl the decl to consider.
|
|
|
|
///
|
|
|
|
/// @return true iff decl is a template parameter.
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
is_template_parameter(const shared_ptr<decl_base> dcl);
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Tests whether a declaration is a type.
|
|
|
|
///
|
|
|
|
/// @param decl the decl to consider.
|
|
|
|
///
|
|
|
|
/// @return true iff decl is a type.
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
is_type(const shared_ptr<decl_base> decl);
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Tests whether a decl is a template parameter composition type.
|
|
|
|
///
|
|
|
|
/// @param dcl the declaration to consider.
|
|
|
|
///
|
|
|
|
/// @return true iff dcl is a template parameter composition type.
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
is_template_parm_composition_type(const shared_ptr<decl_base> dcl);
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Tests whether a decl is a template.
|
|
|
|
///
|
|
|
|
/// @param dcl the decl to consider.
|
|
|
|
///
|
|
|
|
/// @return true iff dcl is a function template, class template, or
|
|
|
|
/// template template parameter.
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
is_template_decl(const shared_ptr<decl_base> dcl);
|
2013-08-02 03:16:22 +00:00
|
|
|
|
2013-08-02 23:30:56 +00:00
|
|
|
/// Test whether a decl is the pattern of a function template.
|
|
|
|
///
|
|
|
|
/// @param dcl the decl to consider.
|
|
|
|
///
|
|
|
|
/// @return true iff dcl is the pattern of a function template.
|
2013-08-02 03:16:22 +00:00
|
|
|
bool
|
2013-08-02 23:30:56 +00:00
|
|
|
is_function_template_pattern(const shared_ptr<decl_base> dcl);
|
|
|
|
|
|
|
|
|
|
|
|
/// Appends a declaration to a given scope, if the declaration
|
|
|
|
/// doesn't already belong to one.
|
|
|
|
///
|
|
|
|
/// @param dcl the declaration to add to the scope
|
|
|
|
///
|
|
|
|
/// @param scpe the scope to append the declaration to
|
|
|
|
void
|
|
|
|
add_decl_to_scope(shared_ptr<decl_base> dcl, scope_decl* scpe);
|
|
|
|
|
|
|
|
/// Appends a declaration to a given scope, if the declaration doesn't already
|
|
|
|
/// belong to a scope.
|
|
|
|
///
|
|
|
|
/// @param dcl the declaration to add append to the scope
|
|
|
|
///
|
|
|
|
/// @param scpe the scope to append the dcl to
|
|
|
|
void
|
|
|
|
add_decl_to_scope(shared_ptr<decl_base> dcl, shared_ptr<scope_decl> scpe);
|
|
|
|
|
|
|
|
/// Return the global scope as seen by a given declaration.
|
|
|
|
///
|
|
|
|
/// @param dcl the declaration to consider.
|
|
|
|
///
|
|
|
|
/// @return the global scope of the decl, or a null pointer if the
|
|
|
|
/// decl is not yet added to a translation_unit.
|
|
|
|
global_scope*
|
|
|
|
get_global_scope(const shared_ptr<decl_base> dcl);
|
|
|
|
|
|
|
|
/// Return the translation unit a declaration belongs to.
|
|
|
|
///
|
|
|
|
/// @param dcl the declaration to consider.
|
|
|
|
///
|
|
|
|
/// @return the resulting translation unit, or null if the decl is not
|
|
|
|
/// yet added to a translation unit.
|
|
|
|
translation_unit*
|
|
|
|
get_translation_unit(const shared_ptr<decl_base> dcl);
|
|
|
|
|
|
|
|
|
2013-08-02 03:16:22 +00:00
|
|
|
} // end namespace abigail
|
|
|
|
#endif // __ABG_IRFWD_H__
|