[clang-format] Handle object instansiation in if-statements
authorTobias Hieta <tobias.hieta@ubisoft.com>
Mon, 7 Nov 2022 07:34:40 +0000 (08:34 +0100)
committerTobias Hieta <tobias@hieta.se>
Mon, 7 Nov 2022 07:34:57 +0000 (08:34 +0100)
commit70de684d44135b4025d92b2b36ad387cf5ab8b5a
tree9c607e577e231b012df9c8d88aabc1927cd24449
parent9a3b969d1faa77d4c629ddb797d317579fbe0555
[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
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp