[llvm-bugs] [Bug 36294] New: AlwaysBreakAfterReturnType works incorrectly for some operator functions

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 8 02:00:15 PST 2018


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

            Bug ID: 36294
           Summary: AlwaysBreakAfterReturnType works incorrectly for some
                    operator functions
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: artemiev.mikhail at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Tried it with the latest trunk code.

$ cat /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; }

$ 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;
}

As you can see there is no break after the return type for the operators !, *
and ->

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180208/c1e33851/attachment.html>


More information about the llvm-bugs mailing list