[PATCH] D129940: [clang-format] Fix misannotation of colon in presence of requires clause

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 17 05:22:43 PDT 2022


HazardyKnusperkeks added inline comments.


================
Comment at: clang/unittests/Format/TokenAnnotatorTest.cpp:820-833
+  ASSERT_EQ(BaseTokens.size(), NumberOfBaseTokens) << BaseTokens;
+  ASSERT_EQ(ConstrainedTokens.size(),
+            NumberOfBaseTokens + NumberOfAdditionalRequiresClauseTokens)
+      << ConstrainedTokens;
+
+  for (auto I = 0u; I < NumberOfBaseTokens; ++I) {
+    if (I < NumberOfTokensBeforeRequires) {
----------------
curdeius wrote:
> owenpan wrote:
> > Can you make it a function or lambda?
> :+1:
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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129940/new/

https://reviews.llvm.org/D129940



More information about the cfe-commits mailing list