20#include "lib/cstring.h"
21#include "lib/exceptions.h"
23#include "lib/source_file.h"
36 if (n.isNullOrEmpty()) BUG(
"Identifier with no name");
39 if (n.isNullOrEmpty()) BUG(
"Identifier with no name");
45 void dbprint(std::ostream &out)
const override {
47 if (originalName !=
nullptr && originalName != name) out <<
"/" << originalName;
49 bool operator==(
const ID &a)
const {
return name == a.name; }
50 bool operator!=(
const ID &a)
const {
return name != a.name; }
53 bool operator==(
cstring a)
const {
return name == a; }
54 bool operator!=(
cstring a)
const {
return name != a; }
57 bool operator==(
const char *a)
const {
return name == a; }
58 bool operator!=(
const char *a)
const {
return name != a; }
60 bool operator<(
const char *a)
const {
return name < a; }
61 explicit operator bool()
const {
return name; }
62 operator cstring()
const {
return name; }
63 std::string string()
const {
return name.string(); }
64 std::string_view string_view()
const {
return name.string_view(); }
65 bool isDontCare()
const {
return name ==
"_"; }
66 Util::SourceInfo getSourceInfo()
const override {
return srcInfo; }
67 cstring toString()
const override {
return originalName.isNullOrEmpty() ? name : originalName; }
Definition stringify.h:33
Definition source_file.h:221
Definition source_file.h:125
The namespace encapsulating IR node classes.
bool operator<(cstring a) const
Defer to cstring's notion of less, which is a lexicographical and not a pointer comparison.
Definition id.h:56
bool operator<(const char *a) const
Defer to cstring's notion of less, which is a lexicographical and not a pointer comparison.
Definition id.h:60
bool operator<(const ID &a) const
Defer to cstring's notion of less, which is a lexicographical and not a pointer comparison.
Definition id.h:52