libabigail
Loading...
Searching...
No Matches
location Class Reference

The source location of a token. More...

#include <abg-ir.h>

Public Member Functions

 location ()
 Default constructor for the location type.
 
 location (const location &l)
 Copy constructor of the location.
 
void expand (std::string &path, unsigned &line, unsigned &column) const
 Expand the current location into a tripplet file path, line and column number.
 
string expand (void) const
 Expand the location into a string.
 
bool get_is_artificial () const
 Test if the location is artificial.
 
unsigned get_value () const
 Get the value of the location.
 
 operator bool () const
 Convert the location into a boolean.
 
bool operator< (const location &other) const
 "Less than" operator of the location type.
 
locationoperator= (const location &l)
 Assignment operator of the location.
 
bool operator== (const location &other) const
 Equality operator of the location type.
 
void set_is_artificial (bool f)
 Set the artificial-ness of the location.
 

Friends

class location_manager
 

Detailed Description

The source location of a token.

This represents the location of a token coming from a given translation unit. This location is actually an abstraction of cursor in the table of all the locations of all the tokens of the translation unit. That table is managed by the location_manager type. To get the file path, line and column numbers associated to a given instance of location, you need to use the location_manager::expand_location method.

Definition at line 306 of file abg-ir.h.

Constructor & Destructor Documentation

◆ location() [1/2]

location ( const location & l)
inline

Copy constructor of the location.

Parameters
lthe location to copy from.

Definition at line 370 of file abg-ir.h.

◆ location() [2/2]

location ( )
inline

Default constructor for the location type.

Definition at line 389 of file abg-ir.h.

Member Function Documentation

◆ expand() [1/2]

void expand ( std::string & path,
unsigned & line,
unsigned & column ) const

Expand the current location into a tripplet file path, line and column number.

Expand the location into a tripplet path, line and column number.

Parameters
paththe output parameter this function sets the expanded path to.
linethe output parameter this function sets the expanded line number to.
columnthe output parameter this function sets the expanded column number to.
paththe output parameter where this function sets the expanded path.
linethe output parameter where this function sets the expanded line.
columnthe ouptut parameter where this function sets the expanded column.

Definition at line 452 of file abg-ir.cc.

◆ expand() [2/2]

string expand ( void ) const

Expand the location into a string.

Returns
the string representing the location.

Definition at line 472 of file abg-ir.cc.

◆ get_is_artificial()

bool get_is_artificial ( ) const
inline

Test if the location is artificial.

Being artificial means that the location wasn't generated by the original emitter of the metadata (i.e, the compiler if the metadata is debug info). For instance, the implicit location derived from the position of a given XML element in the abixml file is represented as artificial locations. The same XML element might carry a non-artificial (natural?) location that was originally emitted by the compiler that generated the original debug info the abixml file is derived from.

Returns
true iff the location is artificial.

Definition at line 348 of file abg-ir.h.

◆ get_value()

unsigned get_value ( ) const
inline

Get the value of the location.

Definition at line 395 of file abg-ir.h.

◆ operator bool()

operator bool ( ) const
inline

Convert the location into a boolean.

Returns
true iff the value of the location is different from zero.

Definition at line 402 of file abg-ir.h.

◆ operator<()

bool operator< ( const location & other) const
inline

"Less than" operator of the location type.

@parm other the other location type to compare against.

Returns
true iff the current instance is less than the other one.

Definition at line 420 of file abg-ir.h.

◆ operator=()

location & operator= ( const location & l)
inline

Assignment operator of the location.

Parameters
lthe location to assign to the current one.

Definition at line 380 of file abg-ir.h.

◆ operator==()

bool operator== ( const location & other) const
inline

Equality operator of the location type.

Parameters
otherthe other location to compare against.
Returns
true iff both locations are equal.

Definition at line 411 of file abg-ir.h.

◆ set_is_artificial()

void set_is_artificial ( bool f)
inline

Set the artificial-ness of the location.

Being artificial means that the location wasn't generated by the original emitter of the metadata (i.e, the compiler if the metadata is debug info). For instance, the implicit location derived from the position of a given XML element in the abixml file is represented as artificial locations. The same XML element might carry a non-artificial (natural?) location that was originally emitted by the compiler that generated the original debug info the abixml file is derived from.

Parameters
fthe new artificial-ness state.

Definition at line 364 of file abg-ir.h.

Friends And Related Symbol Documentation

◆ location_manager

friend class location_manager
friend

Definition at line 441 of file abg-ir.h.


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