@@ -108,6 +108,8 @@ class UnqualifiedLookup {
108
108
// /
109
109
// / If the current DeclContext is nested in a function body, the SourceLoc
110
110
// / is used to determine which declarations in that body are visible.
111
+ UnqualifiedLookup (const char * dummy, DeclName Name, DeclContext *DC, LazyResolver *TypeResolver,
112
+ SourceLoc Loc = SourceLoc(), Options options = Options());
111
113
UnqualifiedLookup (DeclName Name, DeclContext *DC, LazyResolver *TypeResolver,
112
114
SourceLoc Loc = SourceLoc(), Options options = Options());
113
115
@@ -131,6 +133,56 @@ inline UnqualifiedLookup::Options operator|(UnqualifiedLookup::Flags flag1,
131
133
UnqualifiedLookup::Flags flag2) {
132
134
return UnqualifiedLookup::Options (flag1) | flag2;
133
135
}
136
+
137
+
138
+ // / This class implements and represents the result of performing
139
+ // / unqualified lookup (i.e. lookup for a plain identifier).
140
+ class ExpUnqualifiedLookup {
141
+ public:
142
+ using Flags = UnqualifiedLookup::Flags;
143
+
144
+ using Options = UnqualifiedLookup::Options;
145
+
146
+ // / Lookup an unqualified identifier \p Name in the context.
147
+ // /
148
+ // / If the current DeclContext is nested in a function body, the SourceLoc
149
+ // / is used to determine which declarations in that body are visible.
150
+ ExpUnqualifiedLookup (DeclName Name, DeclContext *DC, LazyResolver *TypeResolver,
151
+ SourceLoc Loc = SourceLoc(), Options options = Options());
152
+
153
+ SmallVector<LookupResultEntry, 4 > Results;
154
+ // / The index of the first result that isn't from the innermost scope
155
+ // / with results.
156
+ // /
157
+ // / That is, \c makeArrayRef(Results).take_front(IndexOfFirstOuterResults)
158
+ // / will be Results from the innermost scope that had results, and the
159
+ // / remaining elements of Results will be from parent scopes of this one.
160
+ size_t IndexOfFirstOuterResult;
161
+
162
+ // / Return true if anything was found by the name lookup.
163
+ bool isSuccess () const { return !Results.empty (); }
164
+
165
+ // / Get the result as a single type, or a null type if that fails.
166
+ TypeDecl *getSingleTypeResult ();
167
+
168
+ bool operator ==(const UnqualifiedLookup &other) const {
169
+ if (Results.size () != other.Results .size ())
170
+ return false ;
171
+ for (size_t i: indices (Results)) {
172
+ const auto &e = Results[i];
173
+ const auto &oe = other.Results [i];
174
+ if (e.getValueDecl () != oe.getValueDecl ())
175
+ return false ;
176
+ if (e.getDeclContext () != oe.getDeclContext ())
177
+ return false ;
178
+ if (e.getBaseDecl () != oe.getBaseDecl ())
179
+ return false ;
180
+ }
181
+ return IndexOfFirstOuterResult == other.IndexOfFirstOuterResult ;
182
+ }
183
+
184
+ bool verifyEqual (const UnqualifiedLookup &) const ;
185
+ };
134
186
135
187
// / Describes the reason why a certain declaration is visible.
136
188
enum class DeclVisibilityKind {
0 commit comments