[clang-format] Don't allow template to be preceded by closing brace
authorEmilia Kond <emilia@rymiel.space>
Tue, 16 May 2023 22:35:22 +0000 (01:35 +0300)
committerEmilia Kond <emilia@rymiel.space>
Tue, 16 May 2023 22:37:19 +0000 (01:37 +0300)
commite4d3e88802390a51ae62ade18e48c1a65a862d12
tree2a22b83ac8bb03546478afc52b1c9e7ff07f22a3
parent407346c10e266183121f97e7e379cf0ab73ea2a2
[clang-format] Don't allow template to be preceded by closing brace

This check is similar to the right paren check right below it, but it
doesn't need the overloaded operator check.

This patch prevents brace-initialized objects that are being compared
from being mis-annotated as template parameters.

Fixes https://github.com/llvm/llvm-project/issues/57004

Reviewed By: owenpan, MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D150629
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp