GCC Middle and Back End API Reference
diagnostics::option_classifier Class Reference

#include <option-classifier.h>

Collaboration diagram for diagnostics::option_classifier:

Data Structures

struct  classification_change_t

Public Member Functions

void init (int n_opts)
void fini ()
void push ()
void pop (location_t where)
bool option_unspecified_p (option_id opt_id) const
enum kind get_current_override (option_id opt_id) const
enum kind classify_diagnostic (const context *context, option_id opt_id, enum kind new_kind, location_t where)
enum kind update_effective_level_from_pragmas (diagnostic_info *diagnostic) const
int pch_save (FILE *)
int pch_restore (FILE *)

Private Attributes

int m_n_opts
enum kindm_classify_diagnostic
vec< classification_change_tm_classification_history
vec< int > m_push_list

Friends

class context

Detailed Description

A stack of sets of classifications: each entry in the stack is
a mapping from option index to diagnostic severity that can be changed
via pragmas.  The stack can be pushed and popped.   

Member Function Documentation

◆ classify_diagnostic()

enum kind diagnostics::option_classifier::classify_diagnostic ( const context * dc,
option_id opt_id,
enum kind new_kind,
location_t where )
Interface to specify diagnostic kind overrides.  Returns the
previous setting, or kind::unspecified if the parameters are out of
range.  If OPTION_ID is zero, the new setting is for all the
diagnostics.   

References diagnostics::any, context, FOR_EACH_VEC_ELT_REVERSE, i, diagnostics::option_classifier::classification_change_t::kind, diagnostics::last_diagnostic_kind, m_classification_history, m_classify_diagnostic, diagnostics::option_id::m_idx, m_n_opts, diagnostics::option_classifier::classification_change_t::option, diagnostics::context::option_enabled_p(), and UNKNOWN_LOCATION.

◆ fini()

void diagnostics::option_classifier::fini ( )

◆ get_current_override()

enum kind diagnostics::option_classifier::get_current_override ( option_id opt_id) const
inline

◆ init()

void diagnostics::option_classifier::init ( int n_opts)

◆ option_unspecified_p()

bool diagnostics::option_classifier::option_unspecified_p ( option_id opt_id) const
inline

◆ pch_restore()

int diagnostics::option_classifier::pch_restore ( FILE * f)
Read the diagnostics::option_classifier state from F for PCH
read.  Returns 0 on success, -1 on error.   

References gcc_checking_assert, m_classification_history, and m_push_list.

◆ pch_save()

int diagnostics::option_classifier::pch_save ( FILE * f)
Save the diagnostics::option_classifier state to F for PCH
output.  Returns 0 on success, -1 on error.   

References m_classification_history, and m_push_list.

◆ pop()

void diagnostics::option_classifier::pop ( location_t where)
Restore the topmost classification set off the stack.  If the stack
is empty, revert to the state based on command line parameters.   

References m_classification_history, m_push_list, and diagnostics::pop.

◆ push()

void diagnostics::option_classifier::push ( )
Save all diagnostic classifications in a stack.   

References m_classification_history, and m_push_list.

◆ update_effective_level_from_pragmas()

enum kind diagnostics::option_classifier::update_effective_level_from_pragmas ( diagnostic_info * diagnostic) const
Update the kind of DIAGNOSTIC based on its location(s), including
any of those in its inlining stack, relative to any
  #pragma GCC diagnostic
directives recorded within this object.

Return the new kind of DIAGNOSTIC if it was updated, or kind::unspecified
otherwise.   

References FOR_EACH_VEC_ELT_REVERSE, i, diagnostics::option_classifier::classification_change_t::kind, line_table, diagnostics::option_classifier::classification_change_t::location, m_classification_history, diagnostics::option_classifier::classification_change_t::option, and diagnostics::pop.

◆ context

friend class context
friend

References context.

Referenced by classify_diagnostic(), and context.

Field Documentation

◆ m_classification_history

vec<classification_change_t> diagnostics::option_classifier::m_classification_history
private

◆ m_classify_diagnostic

enum kind* diagnostics::option_classifier::m_classify_diagnostic
private

◆ m_n_opts

int diagnostics::option_classifier::m_n_opts
private

◆ m_push_list

vec<int> diagnostics::option_classifier::m_push_list
private

Referenced by fini(), init(), pch_restore(), pch_save(), pop(), and push().


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