[all-commits] [llvm/llvm-project] 99e5b2: clang-format: fix spacing in `operator const char*()`

Krasimir Georgiev via All-commits all-commits at lists.llvm.org
Mon Mar 2 02:21:17 PST 2020


  Branch: refs/heads/release/10.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 99e5b2ff9df5ca4c7fe13b63f60d953058cd9ca3
      https://github.com/llvm/llvm-project/commit/99e5b2ff9df5ca4c7fe13b63f60d953058cd9ca3
  Author: Krasimir Georgiev <krasimir at google.com>
  Date:   2020-03-02 (Mon, 02 Mar 2020)

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

  Log Message:
  -----------
  clang-format: fix spacing in `operator const char*()`

Summary:
Revision a75f8d98d7ac9e557b238a229a9a2647c71feed1 fixed spacing for operators,
but caused the const and non-const versions to diverge:
```
// With Style.PointerAlignment = FormatStyle::PAS_Left:

struct A {
  operator char*() { return ""; }
  operator const char *() const { return ""; }
};

```
The code was checking if the type specifier was directly preceded by `operator`.
However there could be comments and `const/volatile` in between.

Reviewers: mprobst

Reviewed By: mprobst

Subscribers: cfe-commits

Tags: #clang

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

(cherry picked from commit 33463cfba2be7c8d6c08e666123cc34f114a1f3e)




More information about the All-commits mailing list