11#include "lib/cstring.h"
12#include "lib/exceptions.h"
14#include "lib/source_file.h"
27 if (n.isNullOrEmpty()) BUG(
"Identifier with no name");
30 if (n.isNullOrEmpty()) BUG(
"Identifier with no name");
37 void dbprint(std::ostream &out)
const override {
39 if (originalName !=
nullptr && originalName != name) out <<
"/" << originalName;
41 bool operator==(
const ID &a)
const {
return name == a.name; }
42 bool operator!=(
const ID &a)
const {
return name != a.name; }
44 bool operator<(
const ID &a)
const {
return name < a.name; }
45 bool operator==(
cstring a)
const {
return name == a; }
46 bool operator!=(
cstring a)
const {
return name != a; }
49 bool operator==(
const char *a)
const {
return name == a; }
50 bool operator!=(
const char *a)
const {
return name != a; }
52 bool operator<(
const char *a)
const {
return name < a; }
53 explicit operator bool()
const {
return name.c_str() !=
nullptr; }
54 operator cstring()
const {
return name; }
55 std::string string()
const {
return name.string(); }
56 std::string_view string_view()
const {
return name.string_view(); }
57 bool isDontCare()
const {
return name ==
"_"; }
58 Util::SourceInfo getSourceInfo()
const override {
return srcInfo; }
59 cstring toString()
const override {
return originalName.isNullOrEmpty() ? name : originalName; }
63 template <
typename Sink>
65 sink.Append(
id.string_view());
Definition stringify.h:24
Definition source_file.h:214
Definition source_file.h:123
The namespace encapsulating IR node classes.
Definition constantParsing.h:13
bool operator<(cstring a) const
Defer to cstring's notion of less, which is a lexicographical and not a pointer comparison.
Definition id.h:48
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:52
friend void AbslStringify(Sink &sink, const ID &id)
Definition id.h:64
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:44