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");
46 void dbprint(std::ostream &out)
const override {
48 if (originalName !=
nullptr && originalName != name) out <<
"/" << originalName;
50 bool operator==(
const ID &a)
const {
return name == a.name; }
51 bool operator!=(
const ID &a)
const {
return name != a.name; }
54 bool operator==(
cstring a)
const {
return name == a; }
55 bool operator!=(
cstring a)
const {
return name != a; }
58 bool operator==(
const char *a)
const {
return name == a; }
59 bool operator!=(
const char *a)
const {
return name != a; }
61 bool operator<(
const char *a)
const {
return name < a; }
62 explicit operator bool()
const {
return name.c_str() !=
nullptr; }
63 operator cstring()
const {
return name; }
64 std::string string()
const {
return name.string(); }
65 std::string_view string_view()
const {
return name.string_view(); }
66 bool isDontCare()
const {
return name ==
"_"; }
67 Util::SourceInfo getSourceInfo()
const override {
return srcInfo; }
68 cstring toString()
const override {
return originalName.isNullOrEmpty() ? name : originalName; }
72 template <
typename Sink>
74 sink.Append(
id.string_view());
Definition stringify.h:33
Definition source_file.h:227
Definition source_file.h:131
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:57
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:61
friend void AbslStringify(Sink &sink, const ID &id)
Definition id.h:73
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:53