This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Fix misannotation of colon in presence of requires clause
ClosedPublic

Authored by HazardyKnusperkeks on Jul 16 2022, 1:10 PM.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJul 16 2022, 1:10 PM
HazardyKnusperkeks requested review of this revision.Jul 16 2022, 1:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 16 2022, 1:10 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
JohelEGP accepted this revision.Jul 16 2022, 3:53 PM
This revision is now accepted and ready to land.Jul 16 2022, 3:53 PM
owenpan added inline comments.Jul 16 2022, 4:38 PM
clang/unittests/Format/TokenAnnotatorTest.cpp
823–836

Can you make it a function or lambda?

curdeius accepted this revision.Jul 17 2022, 12:54 AM

Ok for me if it's OK for Owen.

clang/unittests/Format/TokenAnnotatorTest.cpp
823–836

👍

clang/unittests/Format/TokenAnnotatorTest.cpp
823–836

Often thought about that. But as @MyDeveloperDay mentioned in different other reviews, we would loose the line where the EXPECT failed, since it would always be the same line.

One step to mitigate that would be to return a bool, then one would loose the "subexpect", only knows which subtest failed.

But an idea I have right now would be to add a StringRef parameter which is then fed into the expect/assert to identify the subtest.

curdeius added inline comments.Jul 17 2022, 7:53 AM
clang/unittests/Format/TokenAnnotatorTest.cpp
823–836

You can then add a function taking a source location maybe (+ optionally a macro passing __FILE__ and __LINE__). WDYT?

owenpan accepted this revision.Jul 17 2022, 2:12 PM
owenpan added inline comments.
clang/unittests/Format/TokenAnnotatorTest.cpp
823–836

Let's take care of this in a separate patch then. If a function or lambda won't do, we can at least use a macro instead?

owenpan added inline comments.Jul 17 2022, 9:52 PM
clang/unittests/Format/TokenAnnotatorTest.cpp
823–836

See D129982.