[all-commits] [llvm/llvm-project] aea60a: [clang-format] Make bitwise and imply requires cla...

Emilia Kond via All-commits all-commits at lists.llvm.org
Tue Oct 22 03:36:50 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aea60ab94db4729bad17daa86ccfc411d48a1699
      https://github.com/llvm/llvm-project/commit/aea60ab94db4729bad17daa86ccfc411d48a1699
  Author: Emilia Kond <emilia at rymiel.space>
  Date:   2024-10-22 (Tue, 22 Oct 2024)

  Changed paths:
    M clang/lib/Format/UnwrappedLineParser.cpp
    M clang/unittests/Format/TokenAnnotatorTest.cpp

  Log Message:
  -----------
  [clang-format] Make bitwise and imply requires clause (#110942)

This patch adjusts the requires clause/expression parser to imply a
requires clause if it is preceded by a bitwise and operator `&`, and
assume it is a reference qualifier. The justification is that bitwise
operations should not be used for requires expressions.

This is a band-aid fix. The real problems lie in the lookahead heuristic
in the same method. It may be worth it to rewrite that whole heuristic
to track more state in the future, instead of just blindly marching
forward across multiple unrelated definitions, since right now, the
definition following the one with the requires clause can influence
whether the heuristic chooses clause or expression.

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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list