[PATCH] D68896: PR43080: Do not build context-sensitive expressions during name classification.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 11 19:09:10 PDT 2019


rsmith marked an inline comment as done.
rsmith added a comment.

In D68896#1706870 <https://reviews.llvm.org/D68896#1706870>, @efriedma wrote:

> Would it make sense to always use ClassifyName from the parser, instead of using ActOnIdExpression?


I like that idea, at least in principle. We'd need to generalize `ClassifyName` to operate on an arbitrary `UnqualifiedId` instead of only on an identifier, and we'd still need something to cover the various current calls to `ActOnIdExpression` from within `Sema`, so I'm not sure whether it'll actually work out cleaner in practice. I'm inclined to defer doing that for now, if that's OK :)



================
Comment at: lib/Sema/SemaDecl.cpp:1191
+  return NameClassification::ContextIndependentExpr(
+      BuildDeclarationNameExpr(SS, Result, ADL));
+}
----------------
efriedma wrote:
> This doesn't depend on the context... because we're going to throw away the expression later anyway?  I guess that makes sense.
Yes, basically; we don't do anything context-dependent right now when building the `UnresolvedLookupExpr`, it's all delayed until we resolve the overload set. I suppose I could make this more explicit by directly creating the `UnresolvedLookupExpr` here, at the cost of duplicating a little of the work done by `BuildDeclarationNameExpr`. WDYT?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68896/new/

https://reviews.llvm.org/D68896





More information about the cfe-commits mailing list