MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::PlainNames Class Reference

Renders Defs with their plain Def::sym instead of Def::unique_name while alive. More...

#include <mim/driver.h>

Public Member Functions

 PlainNames (const Driver *driver)
 Activates plain naming on driver until this guard dies; a null driver leaves it off.
 ~PlainNames ()
bool clashed () const

Static Public Member Functions

static bool claim (const Driver &, Sym sym, uint32_t gid)
 Registers that gid renders as sym and reports whether the plain sym may be used.

Detailed Description

Renders Defs with their plain Def::sym instead of Def::unique_name while alive.

A gid is noise in a diagnostic about the user's source - but it is also the only thing that tells two same-named Defs apart, so PlainNames::clashed reports when a message has to be rendered again with gids. The state lives in Driver::names, so two Drivers formatting at once never share it.

Definition at line 33 of file driver.h.

Constructor & Destructor Documentation

◆ PlainNames()

mim::PlainNames::PlainNames ( const Driver * driver)
explicit

Activates plain naming on driver until this guard dies; a null driver leaves it off.

Definition at line 191 of file driver.cpp.

Referenced by mim::Diag::render().

◆ ~PlainNames()

mim::PlainNames::~PlainNames ( )

Definition at line 202 of file driver.cpp.

Member Function Documentation

◆ claim()

bool mim::PlainNames::claim ( const Driver & driver,
Sym sym,
uint32_t gid )
static

Registers that gid renders as sym and reports whether the plain sym may be used.

Sets the clash flag - but still answers true - if another gid already claimed sym.

Definition at line 208 of file driver.cpp.

References mim::Driver::Names::clashed, and mim::Driver::names().

◆ clashed()

bool mim::PlainNames::clashed ( ) const

Definition at line 206 of file driver.cpp.


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