File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ class SemaLocResolver : public SourceEntityWalker {
188
188
SourceLoc LocToResolve;
189
189
SemaToken SemaTok;
190
190
Type ContainerType;
191
+ llvm::SmallVector<Expr*, 4 > TrailingExprStack;
191
192
192
193
public:
193
194
explicit SemaLocResolver (SourceFile &SrcFile) : SrcFile(SrcFile) { }
@@ -216,7 +217,6 @@ class SemaLocResolver : public SourceEntityWalker {
216
217
SourceLoc Loc, bool IsRef, Type Ty = Type());
217
218
bool tryResolve (ModuleEntity Mod, SourceLoc Loc);
218
219
bool tryResolve (Stmt *St);
219
- bool tryResolve (Expr *Exp);
220
220
bool visitSubscriptReference (ValueDecl *D, CharSourceRange Range,
221
221
bool IsOpenBracket) override ;
222
222
};
Original file line number Diff line number Diff line change @@ -108,14 +108,6 @@ bool SemaLocResolver::tryResolve(Stmt *St) {
108
108
return false ;
109
109
}
110
110
111
- bool SemaLocResolver::tryResolve (Expr *Exp) {
112
- if (!Exp->isImplicit () && Exp->getStartLoc () == LocToResolve) {
113
- SemaTok = { Exp };
114
- return true ;
115
- }
116
- return false ;
117
- }
118
-
119
111
bool SemaLocResolver::visitSubscriptReference (ValueDecl *D, CharSourceRange Range,
120
112
bool IsOpenBracket) {
121
113
// We should treat both open and close brackets equally
@@ -193,14 +185,23 @@ bool SemaLocResolver::walkToExprPre(Expr *E) {
193
185
ContainerType = ME->getBase ()->getType ();
194
186
}
195
187
}
188
+
189
+ // Keep track of trailing expressions.
190
+ if (!E->isImplicit () && E->getStartLoc () == LocToResolve)
191
+ TrailingExprStack.push_back (E);
196
192
}
197
193
return true ;
198
194
}
199
195
200
196
bool SemaLocResolver::walkToExprPost (Expr *E) {
201
197
if (isDone ())
202
198
return false ;
203
- return !tryResolve (E);
199
+ if (!TrailingExprStack.empty () && TrailingExprStack.back () == E) {
200
+ // We return the outtermost expression in the token info.
201
+ SemaTok = { TrailingExprStack.front () };
202
+ return false ;
203
+ }
204
+ return true ;
204
205
}
205
206
206
207
bool SemaLocResolver::visitCallArgName (Identifier Name, CharSourceRange Range,
You can’t perform that action at this time.
0 commit comments