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

#include <analyzer-logging.h>

Collaboration diagram for ana::log_scope:

Public Member Functions

 log_scope (logger *logger, const char *name)
 
 log_scope (logger *logger, const char *name, const char *fmt,...) ATTRIBUTE_GCC_DIAG(4
 
 ~log_scope ()
 

Private Member Functions

 DISABLE_COPY_AND_ASSIGN (log_scope)
 

Private Attributes

loggerm_logger
 
const char * m_name
 

Detailed Description

The class log_scope is an RAII-style class intended to make
it easy to notify a logger about entering and exiting the body of a
given function.   

Constructor & Destructor Documentation

◆ log_scope() [1/2]

ana::log_scope::log_scope ( logger * logger,
const char * name )
inline
The constructor for log_scope.

The normal case is that the logger is NULL, in which case this should
be largely a no-op.

If we do have a logger, notify it that we're entering the given scope.
We also need to hold a reference on it, to avoid a use-after-free
when logging the cleanup of the owner of the logger.   

References ana::logger::enter_scope(), ana::logger::incref(), m_logger, and m_name.

◆ log_scope() [2/2]

ana::log_scope::log_scope ( logger * logger,
const char * name,
const char * fmt,
... )
inline

◆ ~log_scope()

ana::log_scope::~log_scope ( )
inline
The destructor for log_scope; essentially the opposite of
the constructor.   

References ana::logger::decref(), ana::logger::exit_scope(), m_logger, and m_name.

Member Function Documentation

◆ DISABLE_COPY_AND_ASSIGN()

ana::log_scope::DISABLE_COPY_AND_ASSIGN ( log_scope )
private

Field Documentation

◆ m_logger

logger* ana::log_scope::m_logger
private

Referenced by log_scope(), log_scope(), and ~log_scope().

◆ m_name

const char* ana::log_scope::m_name
private

Referenced by log_scope(), log_scope(), and ~log_scope().


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