GCC Middle and Back End API Reference
option_proposer Class Reference

#include <opt-suggestions.h>

Collaboration diagram for option_proposer:

Public Member Functions

 option_proposer ()
 
 ~option_proposer ()
 
const char * suggest_option (const char *bad_opt)
 
void suggest_completion (const char *option_prefix)
 
void get_completions (const char *option_prefix, auto_string_vec &results)
 

Private Member Functions

void build_option_suggestions (const char *prefix)
 

Private Attributes

auto_string_vecm_option_suggestions
 

Detailed Description

Provide suggestions to handle misspelled options, and implement the
   --complete option for auto-completing options from a prefix.
   Copyright (C) 2016-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC 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 Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Option proposer is class used by driver in order to provide hints
for wrong options provided.  And it's used by --complete option that's
intended to be invoked by BASH in order to provide better option
completion support.   

Constructor & Destructor Documentation

◆ option_proposer()

option_proposer::option_proposer ( )
inline

◆ ~option_proposer()

option_proposer::~option_proposer ( )
Provide option suggestion for --complete option and a misspelled
   used by a user.
   Copyright (C) 2016-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC 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 Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   

References m_option_suggestions.

Member Function Documentation

◆ build_option_suggestions()

◆ get_completions()

void option_proposer::get_completions ( const char * option_prefix,
auto_string_vec & results )
Populate RESULTS with valid completions of options that begin
with OPTION_PREFIX.   

References build_option_suggestions(), candidate(), gcc_assert, i, m_option_suggestions, and NULL.

Referenced by suggest_completion().

◆ suggest_completion()

void option_proposer::suggest_completion ( const char * option_prefix)
Print on stdout a list of valid options that begin with OPTION_PREFIX,
one per line, suitable for use by Bash completion.

Implementation of the "-completion=" option.   

References get_completions(), and i.

Referenced by driver::main().

◆ suggest_option()

const char * option_proposer::suggest_option ( const char * bad_opt)

Field Documentation

◆ m_option_suggestions

auto_string_vec* option_proposer::m_option_suggestions
private

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