mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 09:08:20 +00:00
Obj: make the Location constructors constexpr
This commit is contained in:
parent
ba445d36f9
commit
b4966858ce
1 changed files with 8 additions and 16 deletions
24
src/Obj.h
24
src/Obj.h
|
@ -8,20 +8,12 @@ class ODesc;
|
|||
|
||||
class Location final {
|
||||
public:
|
||||
Location(const char* fname, int line_f, int line_l, int col_f, int col_l)
|
||||
{
|
||||
filename = fname;
|
||||
first_line = line_f;
|
||||
last_line = line_l;
|
||||
first_column = col_f;
|
||||
last_column = col_l;
|
||||
}
|
||||
constexpr Location(const char* fname, int line_f, int line_l,
|
||||
int col_f, int col_l) noexcept
|
||||
:filename(fname), first_line(line_f), last_line(line_l),
|
||||
first_column(col_f), last_column(col_l) {}
|
||||
|
||||
Location()
|
||||
{
|
||||
filename = 0;
|
||||
first_line = last_line = first_column = last_column = 0;
|
||||
}
|
||||
Location() = default;
|
||||
|
||||
void Describe(ODesc* d) const;
|
||||
|
||||
|
@ -29,9 +21,9 @@ public:
|
|||
bool operator!=(const Location& l) const
|
||||
{ return ! (*this == l); }
|
||||
|
||||
const char* filename;
|
||||
int first_line, last_line;
|
||||
int first_column, last_column;
|
||||
const char* filename = nullptr;
|
||||
int first_line = 0, last_line = 0;
|
||||
int first_column = 0, last_column = 0;
|
||||
};
|
||||
|
||||
#define YYLTYPE yyltype
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue