[clang] [clang][HIP][CUDA] Disambiguate lambdas from Microsoft attributes (PR #214247)
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 7 13:53:24 PDT 2026
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
More information about the cfe-commits
mailing list