[all-commits] [llvm/llvm-project] 70de68: [clang-format] Handle object instansiation in if-s...

Tobias Hieta via All-commits all-commits at lists.llvm.org
Sun Nov 6 23:35:12 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 70de684d44135b4025d92b2b36ad387cf5ab8b5a
      https://github.com/llvm/llvm-project/commit/70de684d44135b4025d92b2b36ad387cf5ab8b5a
  Author: Tobias Hieta <tobias.hieta at ubisoft.com>
  Date:   2022-11-07 (Mon, 07 Nov 2022)

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

  Log Message:
  -----------
  [clang-format] Handle object instansiation in if-statements

Before this patch code like this:

```
if (Class* obj{getObject()}) { }
```

would be mis-formated since the * would be annotated as a
binaryoperator.

This patch changes the * to become a PointerOrReference instead
and fixes the formatting issues.

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D137327




More information about the All-commits mailing list