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

#include <output-file.h>

Public Member Functions

 output_file ()
 output_file (FILE *outf, bool owned, label_text filename)
 ~output_file ()
 output_file (const output_file &other)=delete
 output_file (output_file &&other)
output_fileoperator= (const output_file &other)=delete
output_fileoperator= (output_file &&other)
 operator bool () const
FILE * get_open_file () const
const char * get_filename () const

Static Public Member Functions

static output_file try_to_open (context &dc, line_maps *line_maps, const char *base_file_name, const char *extension, bool binary)

Private Attributes

FILE * m_outf
bool m_owned
label_text m_filename

Detailed Description

RAII class for wrapping a FILE * that could be borrowed or owned,
along with the underlying filename.   

Constructor & Destructor Documentation

◆ output_file() [1/4]

diagnostics::output_file::output_file ( )
inline

◆ output_file() [2/4]

diagnostics::output_file::output_file ( FILE * outf,
bool owned,
label_text filename )
inline

References gcc_assert, m_filename, m_outf, and m_owned.

◆ ~output_file()

diagnostics::output_file::~output_file ( )
inline

References gcc_assert, m_outf, and m_owned.

◆ output_file() [3/4]

diagnostics::output_file::output_file ( const output_file & other)
delete

References output_file().

◆ output_file() [4/4]

diagnostics::output_file::output_file ( output_file && other)
inline

Member Function Documentation

◆ get_filename()

const char * diagnostics::output_file::get_filename ( ) const
inline

References m_filename.

◆ get_open_file()

FILE * diagnostics::output_file::get_open_file ( ) const
inline

References m_outf.

◆ operator bool()

diagnostics::output_file::operator bool ( ) const
inline

References m_outf.

◆ operator=() [1/2]

output_file & diagnostics::output_file::operator= ( const output_file & other)
delete

References output_file().

◆ operator=() [2/2]

output_file & diagnostics::output_file::operator= ( output_file && other)
inline

◆ try_to_open()

output_file diagnostics::output_file::try_to_open ( context & dc,
line_maps * line_maps,
const char * base_file_name,
const char * extension,
bool is_binary )
static
Attempt to open "BASE_FILE_NAME""EXTENSION" for writing.
Return a non-null output_file,
or return a null output_file and complain to DC
using LINE_MAPS.   

References base_file_name(), diagnostics::context::emit_diagnostic_with_group(), fopen, gcc_assert, output_file, and UNKNOWN_LOCATION.

Referenced by diagnostics::open_sarif_output_file().

Field Documentation

◆ m_filename

label_text diagnostics::output_file::m_filename
private

◆ m_outf

FILE* diagnostics::output_file::m_outf
private

◆ m_owned

bool diagnostics::output_file::m_owned
private

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