GCC Middle and Back End API Reference
ana::known_function_manager Class Reference

#include <known-function-manager.h>

Inheritance diagram for ana::known_function_manager:
Collaboration diagram for ana::known_function_manager:

Public Member Functions

 known_function_manager (logger *logger)
 
 ~known_function_manager ()
 
void add (const char *name, std::unique_ptr< known_function > kf)
 
void add_std_ns (const char *name, std::unique_ptr< known_function > kf)
 
void add (enum built_in_function name, std::unique_ptr< known_function > kf)
 
void add (enum internal_fn ifn, std::unique_ptr< known_function > kf)
 
const known_functionget_match (tree fndecl, const call_details &cd) const
 
const known_functionget_internal_fn (enum internal_fn) const
 
loggerget_logger () const
 
void set_logger (logger *logger)
 
void log (const char *fmt,...) const ATTRIBUTE_GCC_DIAG(2
 
void void start_log_line () const
 
void end_log_line () const
 
void enter_scope (const char *scope_name)
 
void exit_scope (const char *scope_name)
 
pretty_printerget_logger_pp () const
 
FILEget_logger_file () const
 

Private Member Functions

 DISABLE_COPY_AND_ASSIGN (known_function_manager)
 
const known_functionget_normal_builtin (enum built_in_function name) const
 
const known_functionget_normal_builtin (const builtin_known_function *builtin_kf) const
 
const known_functionget_by_identifier (tree identifier) const
 
const known_functionget_by_identifier_in_std_ns (tree identifier) const
 

Private Attributes

hash_map< tree, known_function * > m_map_id_to_kf
 
hash_map< tree, known_function * > m_std_ns_map_id_to_kf
 
known_functionm_combined_fns_arr [CFN_LAST]
 
loggerm_logger
 

Detailed Description

Instances of known_function are registered with the known_function_manager
when the analyzer starts.

The known_function_manager has responsibility for determining which
known_function instance (if any) is relevant at a call site, by checking
name or id, and by calling known_function::matches_call_types_p to ensure
that the known_function's preconditions hold (typically assumptions about
types e.g. that "has 3 args, and that arg 0 is of pointer type").

The known_function subclasses themselves have responsibility for
determining the outcome(s) of the call.   

Constructor & Destructor Documentation

◆ known_function_manager()

ana::known_function_manager::known_function_manager ( logger * logger)

◆ ~known_function_manager()

ana::known_function_manager::~known_function_manager ( )

Member Function Documentation

◆ add() [1/3]

void ana::known_function_manager::add ( const char * name,
std::unique_ptr< known_function > kf )

◆ add() [2/3]

void ana::known_function_manager::add ( enum built_in_function name,
std::unique_ptr< known_function > kf )

◆ add() [3/3]

void ana::known_function_manager::add ( enum internal_fn ifn,
std::unique_ptr< known_function > kf )

◆ add_std_ns()

void ana::known_function_manager::add_std_ns ( const char * name,
std::unique_ptr< known_function > kf )

◆ DISABLE_COPY_AND_ASSIGN()

ana::known_function_manager::DISABLE_COPY_AND_ASSIGN ( known_function_manager )
private

◆ end_log_line()

void ana::log_user::end_log_line ( ) const
inlineinherited
A shortcut for ending a log line from a log_user,
handling the common case where the underlying logger is NULL via
a no-op.   

References ana::logger::end_log_line(), and ana::log_user::m_logger.

◆ enter_scope()

void ana::log_user::enter_scope ( const char * scope_name)
inlineinherited
A shortcut for recording entry into a scope from a log_user,
handling the common case where the underlying logger is NULL via
a no-op.   

References ana::logger::enter_scope(), ggc_alloc(), and ana::log_user::m_logger.

◆ exit_scope()

void ana::log_user::exit_scope ( const char * scope_name)
inlineinherited
A shortcut for recording exit from a scope from a log_user,
handling the common case where the underlying logger is NULL via
a no-op.   

References ana::logger::exit_scope(), ggc_alloc(), and ana::log_user::m_logger.

◆ get_by_identifier()

const known_function * ana::known_function_manager::get_by_identifier ( tree identifier) const
private

◆ get_by_identifier_in_std_ns()

const known_function * ana::known_function_manager::get_by_identifier_in_std_ns ( tree identifier) const
private

◆ get_internal_fn()

const known_function * ana::known_function_manager::get_internal_fn ( enum internal_fn) const

◆ get_logger()

logger * ana::log_user::get_logger ( ) const
inlineinherited

◆ get_logger_file()

FILE * ana::log_user::get_logger_file ( ) const
inlineinherited

◆ get_logger_pp()

pretty_printer * ana::log_user::get_logger_pp ( ) const
inlineinherited

◆ get_match()

const known_function * ana::known_function_manager::get_match ( tree fndecl,
const call_details & cd ) const

◆ get_normal_builtin() [1/2]

const known_function * ana::known_function_manager::get_normal_builtin ( const builtin_known_function * builtin_kf) const
private

◆ get_normal_builtin() [2/2]

const known_function * ana::known_function_manager::get_normal_builtin ( enum built_in_function name) const
private

◆ log()

void ana::log_user::log ( const char * fmt,
... ) const
inlineinherited
A shortcut for calling log from a log_user, handling the common
case where the underlying logger is NULL via a no-op.   

References ap, ggc_alloc(), ana::logger::log_va(), and ana::log_user::m_logger.

◆ set_logger()

void ana::log_user::set_logger ( logger * logger)
inherited

◆ start_log_line()

void ana::log_user::start_log_line ( ) const
inlineinherited
A shortcut for starting a log line from a log_user,
handling the common case where the underlying logger is NULL via
a no-op.   

References ana::log_user::m_logger, and ana::logger::start_log_line().

Field Documentation

◆ m_combined_fns_arr

known_function* ana::known_function_manager::m_combined_fns_arr[CFN_LAST]
private

◆ m_logger

◆ m_map_id_to_kf

hash_map<tree, known_function *> ana::known_function_manager::m_map_id_to_kf
private

◆ m_std_ns_map_id_to_kf

hash_map<tree, known_function *> ana::known_function_manager::m_std_ns_map_id_to_kf
private

The documentation for this class was generated from the following file: