rnk wrote:

A used codex to analyze the PR ([raw 
transcript](https://gist.github.com/rnk/55faeb309e6696433d3e112fff222528), and 
it suggested an alternative pathway that involves editing *just* the *tenative 
parsing* codepaths.

Specifically, if we only need to do this disambiguation for vexing-parse cases, 
where we need to distinguish between parameters which could either be an 
expression or a parameter declaration, you should be able to limit the changes 
to these code locations:

[  
clang/lib/Parse/ParseTentative.cpp:1736](https://github.com/llvm/llvm-project/blob/5188dfc273470d3c47eac980128f66e7fb898b3d/clang/lib/Parse/ParseTentative.cpp#L1736)
```
  ParsedAttributes attrs(AttrFactory);
  MaybeParseMicrosoftAttributes(attrs);

  // decl-specifier-seq
  TPResult TPR = isCXXDeclarationSpecifier(...);
```

The value of narrowing the scope of the change would be to avoid the compile 
time hit of tentatively parsing forwards every time we see a left square 
bracket in a declaration sequence, something which might be a microsoft 
attribute. However, this could happen approximately never, in which case, maybe 
you're fix is better. I think lambdas often appear in type-or-expression 
contexts, so my sense is that it happens fairly often, and if we can limit the 
tentative parse to just parameter lists, that seems like it would be a win.

https://github.com/llvm/llvm-project/pull/214247
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to