[clang] [clang-format] Make bitwise and imply requires clause (PR #110942)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 27 14:48:15 PDT 2024
================
@@ -1296,6 +1296,15 @@ TEST_F(TokenAnnotatorTest, UnderstandsRequiresClausesAndConcepts) {
Tokens = annotate("bool x = t && requires(Foo<C1 || C2> x) { x.foo(); };");
ASSERT_EQ(Tokens.size(), 25u) << Tokens;
EXPECT_TOKEN(Tokens[5], tok::kw_requires, TT_RequiresExpression);
+
+ // Second function definition is required due to lookahead
+ Tokens = annotate("void f() &\n"
----------------
owenca wrote:
> I'm not against rewriting the heuristic, if you know a better one. But for this example could one not extent the look behind? Than it would also work for r-value references.
No, because we can't tell if the r_paren before `&& requires` is a function decl r_paren?
> Or try to annotate the reference marker and match on that?
No, because we're in `UnwrappedLineParser`?
https://github.com/llvm/llvm-project/pull/110942
More information about the cfe-commits
mailing list