This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Don't allow template to be preceded by closing brace
ClosedPublic

Authored by rymiel on May 15 2023, 6:22 PM.

Details

Summary

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

Diff Detail

Event Timeline

rymiel created this revision.May 15 2023, 6:22 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 15 2023, 6:22 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
rymiel requested review of this revision.May 15 2023, 6:22 PM
owenpan added inline comments.May 15 2023, 6:51 PM
clang/unittests/Format/FormatTest.cpp
10682

Do we need to add a token annotator test?

clang/unittests/Format/FormatTest.cpp
10682

Do we need to add a token annotator test?

I'm in favor of one.

rymiel updated this revision to Diff 522776.May 16 2023, 1:56 PM

Add annotator tests

rymiel marked 2 inline comments as done.May 16 2023, 1:56 PM
owenpan accepted this revision.May 16 2023, 2:47 PM
This revision is now accepted and ready to land.May 16 2023, 2:47 PM
MyDeveloperDay accepted this revision.May 16 2023, 3:15 PM
This revision was landed with ongoing or failed builds.May 16 2023, 3:38 PM
This revision was automatically updated to reflect the committed changes.