This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Ensure we can correctly parse lambda in the template argument list
ClosedPublic

Authored by MyDeveloperDay on Jan 7 2022, 6:18 AM.

Details

Summary

https://github.com/llvm/llvm-project/issues/46505

The presence of a lambda in an argument template list ignored the [] as a lambda at all, this caused the contents of the <> to be incorrectly analyzed.

struct Y : X < [] {
  return 0;
} > {};

Fixes: #46505

Diff Detail

Event Timeline

MyDeveloperDay requested review of this revision.Jan 7 2022, 6:18 AM
MyDeveloperDay created this revision.
curdeius accepted this revision.Jan 7 2022, 7:12 AM

LGTM.

clang/unittests/Format/FormatTest.cpp
23222

Is this line necessary? It doesn't seem to test anything new, no?

This revision is now accepted and ready to land.Jan 7 2022, 7:12 AM
clang/lib/Format/UnwrappedLineParser.cpp
2877–2879

Fewer ifs and lines.