Jlm
attribute.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
7 
8 namespace jlm::llvm
9 {
10 
11 Attribute::~Attribute() noexcept = default;
12 
13 StringAttribute::~StringAttribute() noexcept = default;
14 
15 bool
16 StringAttribute::operator==(const Attribute & other) const
17 {
18  auto sa = dynamic_cast<const StringAttribute *>(&other);
19  return sa && sa->kind() == kind() && sa->value() == value();
20 }
21 
22 EnumAttribute::~EnumAttribute() noexcept = default;
23 
24 bool
25 EnumAttribute::operator==(const Attribute & other) const
26 {
27  auto ea = dynamic_cast<const EnumAttribute *>(&other);
28  return ea && ea->kind() == kind();
29 }
30 
31 IntAttribute::~IntAttribute() noexcept = default;
32 
33 bool
34 IntAttribute::operator==(const Attribute & other) const
35 {
36  auto ia = dynamic_cast<const IntAttribute *>(&other);
37  return ia && ia->kind() == kind() && ia->value() == value();
38 }
39 
40 TypeAttribute::~TypeAttribute() noexcept = default;
41 
42 bool
43 TypeAttribute::operator==(const Attribute & other) const
44 {
45  auto ta = dynamic_cast<const TypeAttribute *>(&other);
46  return ta && ta->kind() == kind() && ta->type() == type();
47 }
48 
51 {
52  return EnumAttributes_.Items();
53 }
54 
57 {
58  return IntAttributes_.Items();
59 }
60 
63 {
64  return TypeAttributes_.Items();
65 }
66 
69 {
70  return StringAttributes_.Items();
71 }
72 
73 }
EnumAttributeHashSet EnumAttributes_
Definition: attribute.hpp:369
IntAttributeHashSet IntAttributes_
Definition: attribute.hpp:370
StringAttributeHashSet StringAttributes_
Definition: attribute.hpp:372
EnumAttributeRange EnumAttributes() const
Definition: attribute.cpp:50
TypeAttributeHashSet TypeAttributes_
Definition: attribute.hpp:371
StringAttributeRange StringAttributes() const
Definition: attribute.cpp:68
TypeAttributeRange TypeAttributes() const
Definition: attribute.cpp:62
IntAttributeRange IntAttributes() const
Definition: attribute.cpp:56
virtual ~Attribute() noexcept
~EnumAttribute() noexcept override
const Attribute::kind & kind() const noexcept
Definition: attribute.hpp:186
Integer attribute.
Definition: attribute.hpp:201
~IntAttribute() noexcept override
String attribute.
Definition: attribute.hpp:145
const std::string & kind() const noexcept
Definition: attribute.hpp:155
~TypeAttribute() noexcept override
IteratorRange< ItemConstIterator > Items() const noexcept
Definition: HashSet.hpp:223
Global memory state passed between functions.
static std::string type(const Node *n)
Definition: view.cpp:255