[clang-format] Recognize c++ coroutine keywords as unary operator to avoid misleading...
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Tue, 15 Dec 2020 12:50:38 +0000 (20:50 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Tue, 15 Dec 2020 12:50:46 +0000 (20:50 +0800)
commit8b48d24373204fc2fe6aac1f1f850fa3b6c18445
treeb1339e8027ee41d641b84b6d4dc5b44ac396a925
parentffe84d90e9a7279fafbdcaf70da03174a522ab62
[clang-format] Recognize c++ coroutine keywords as unary operator to avoid misleading pointer alignment

Summary: The clang-format may go wrong when handle c++ coroutine keywords and pointer.
The default value for PointerAlignment is PAS_Right. So the following format is good:
```
co_return *a;
```
But within some code style, the value for PointerAlignment is PAS_Left, the behavior goes wrong:
```
co_return* a;
```

test-plan: check-clang

reviewers: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D91245
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp