clang: include/clang/AST/UnresolvedSet.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_AST_UNRESOLVEDSET_H
15#define LLVM_CLANG_AST_UNRESOLVEDSET_H
16
20#include "llvm/ADT/ArrayRef.h"
21#include "llvm/ADT/SmallVector.h"
22#include "llvm/ADT/iterator.h"
23#include
24#include
25
27
29
30
31
32class UnresolvedSetIterator : public llvm::iterator_adaptor_base<
33 UnresolvedSetIterator, DeclAccessPair *,
34 std::random_access_iterator_tag, NamedDecl *,
35 std::ptrdiff_t, NamedDecl *, NamedDecl *> {
39
41 : iterator_adaptor_base(Iter) {}
43 : iterator_adaptor_base(const_cast<DeclAccessPair *>(Iter)) {}
44
45public:
46
47
49
50 uint64_t getDeclID() const { return I->getDeclID(); }
56
59};
60
61
62class UnresolvedSetImpl {
64
65
66
67private:
69
70 UnresolvedSetImpl() = default;
71 UnresolvedSetImpl(const UnresolvedSetImpl &) = default;
72 UnresolvedSetImpl &operator=(const UnresolvedSetImpl &) = default;
73
74 UnresolvedSetImpl(UnresolvedSetImpl &&) = default;
75 UnresolvedSetImpl &operator=(UnresolvedSetImpl &&) = default;
76
77public:
78
79
82
85
88
90
94
98
99
100
101
103 for (DeclsTy::iterator I = decls().begin(), E = decls().end(); I != E; ++I)
104 if (I->getDecl() == Old)
105 return (I->setDecl(New), true);
106 return false;
107 }
108
109
110
112
114 I.I->set(New, AS);
115 }
116
118 auto val = decls().pop_back_val();
119 if (I < size())
120 decls()[I] = val;
121 }
122
124 auto val = decls().pop_back_val();
125 if (I != end())
126 *I.I = val;
127 }
128
130
131 void clear() { decls().clear(); }
132 void truncate(unsigned N) { decls().truncate(N); }
133
134 bool empty() const { return decls().empty(); }
135 unsigned size() const { return decls().size(); }
136
138
139 template void assign(Iter I, Iter E) { decls().assign(I, E); }
140
143
144private:
145
146
147 DeclsTy &decls() {
148 return *reinterpret_cast<DeclsTy*>(this);
149 }
150 const DeclsTy &decls() const {
151 return *reinterpret_cast<const DeclsTy*>(this);
152 }
153};
154
155
157 public UnresolvedSetImpl {
159};
160
161
162}
163
164#endif
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines various enumerations that describe declaration and type specifiers.
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
void setAccess(AccessSpecifier AS)
This represents a decl that may have a name.
bool replace(const NamedDecl *Old, NamedDecl *New)
Replaces the given declaration with the new one, once.
Definition UnresolvedSet.h:102
DeclAccessPair & operator[](unsigned I)
Definition UnresolvedSet.h:141
const_iterator end() const
Definition UnresolvedSet.h:87
void addDecl(NamedDecl *D, AccessSpecifier AS)
Definition UnresolvedSet.h:95
friend class UnresolvedSet
Definition UnresolvedSet.h:68
const DeclAccessPair & operator[](unsigned I) const
Definition UnresolvedSet.h:142
void replace(iterator I, NamedDecl *New, AccessSpecifier AS)
Definition UnresolvedSet.h:113
void setAccess(iterator I, AccessSpecifier AS)
Definition UnresolvedSet.h:129
void clear()
Definition UnresolvedSet.h:131
void replace(iterator I, NamedDecl *New)
Replaces the declaration at the given iterator with the new one, preserving the original access bits.
Definition UnresolvedSet.h:111
const_iterator begin() const
Definition UnresolvedSet.h:86
void erase(iterator I)
Definition UnresolvedSet.h:123
iterator end()
Definition UnresolvedSet.h:84
void erase(unsigned I)
Definition UnresolvedSet.h:117
bool empty() const
Definition UnresolvedSet.h:134
unsigned size() const
Definition UnresolvedSet.h:135
void assign(Iter I, Iter E)
Definition UnresolvedSet.h:139
iterator begin()
Definition UnresolvedSet.h:83
ArrayRef< DeclAccessPair > pairs() const
Definition UnresolvedSet.h:89
UnresolvedSetIterator iterator
Definition UnresolvedSet.h:80
void append(iterator I, iterator E)
Definition UnresolvedSet.h:137
void truncate(unsigned N)
Definition UnresolvedSet.h:132
void addDecl(NamedDecl *D)
Definition UnresolvedSet.h:91
UnresolvedSetIterator const_iterator
Definition UnresolvedSet.h:81
The iterator over UnresolvedSets.
Definition UnresolvedSet.h:35
NamedDecl * operator->() const
Definition UnresolvedSet.h:58
NamedDecl * getDecl() const
Definition UnresolvedSet.h:51
const DeclAccessPair & getPair() const
Definition UnresolvedSet.h:55
AccessSpecifier getAccess() const
Definition UnresolvedSet.h:53
void setDecl(NamedDecl *ND) const
Definition UnresolvedSet.h:52
friend class ASTUnresolvedSet
Definition UnresolvedSet.h:36
friend class UnresolvedSetImpl
Definition UnresolvedSet.h:38
void setAccess(AccessSpecifier AS)
Definition UnresolvedSet.h:54
uint64_t getDeclID() const
Definition UnresolvedSet.h:50
friend class OverloadExpr
Definition UnresolvedSet.h:37
UnresolvedSetIterator()
Definition UnresolvedSet.h:48
NamedDecl * operator*() const
Definition UnresolvedSet.h:57
The JSON file list parser is used to communicate input to InstallAPI.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...