This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Disallow templates to be followed by literal
ClosedPublic

Authored by rymiel on Jan 19 2023, 10:14 AM.

Details

Summary

There should not be any cases where the angle brackets of template
parameters are directly followed by a literal. It is more likely that a
comparison is taking place instead.

This patch makes the TokenAnnotator prefer to annotate < and > as
operators when directly followed by a literal. A similar check already
exists for literals directly *before* potential template args.

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

Diff Detail

Event Timeline

rymiel created this revision.Jan 19 2023, 10:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 10:14 AM
rymiel requested review of this revision.Jan 19 2023, 10:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 10:14 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
rymiel updated this revision to Diff 490584.Jan 19 2023, 10:19 AM

Drop unrelated change

This revision is now accepted and ready to land.Jan 20 2023, 2:44 AM
owenpan accepted this revision.Jan 22 2023, 1:22 AM
MyDeveloperDay accepted this revision.Jan 25 2023, 10:01 AM
This revision was landed with ongoing or failed builds.Jan 26 2023, 5:57 PM
This revision was automatically updated to reflect the committed changes.