[all-commits] [llvm/llvm-project] a75f8d: [clang-format] [PR36294] AlwaysBreakAfterReturnTyp...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Tue Nov 12 01:25:20 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a75f8d98d7ac9e557b238a229a9a2647c71feed1
      https://github.com/llvm/llvm-project/commit/a75f8d98d7ac9e557b238a229a9a2647c71feed1
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2019-11-12 (Tue, 12 Nov 2019)

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

  Log Message:
  -----------
  [clang-format] [PR36294] AlwaysBreakAfterReturnType works incorrectly for some operator functions

Summary:
https://bugs.llvm.org/show_bug.cgi?id=36294

Addressing bug related to returning after return type not being honoured for some operator types.

```
$ bin/clang-format --style="{BasedOnStyle: llvm, AlwaysBreakAfterReturnType: TopLevelDefinitions}" /tmp/foo.cpp
class Foo {
public:
  bool operator!() const;
  bool operator<(Foo const &) const;
  bool operator*() const;
  bool operator->() const;
  bool operator+() const;
  bool operator-() const;
  bool f() const;
};

bool Foo::operator!() const { return true; }
bool
Foo::operator<(Foo const &) const {
  return true;
}
bool Foo::operator*() const { return true; }
bool Foo::operator->() const { return true; }
bool
Foo::operator+() const {
  return true;
}
bool
Foo::operator-() const {
  return true;
}
bool
Foo::f() const {
  return true;
}
```

Reviewers: mitchell-stellar, klimek, owenpan, sammccall, rianquinn

Reviewed By: sammccall

Subscribers: merge_guards_bot, cfe-commits

Tags: #clang-format, #clang-tools-extra, #clang

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




More information about the All-commits mailing list