[all-commits] [llvm/llvm-project] 8b48d2: [clang-format] Recognize c++ coroutine keywords as...

ChuanqiXu9 via All-commits all-commits at lists.llvm.org
Tue Dec 15 04:52:24 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8b48d24373204fc2fe6aac1f1f850fa3b6c18445
      https://github.com/llvm/llvm-project/commit/8b48d24373204fc2fe6aac1f1f850fa3b6c18445
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2020-12-15 (Tue, 15 Dec 2020)

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

  Log Message:
  -----------
  [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




More information about the All-commits mailing list