[PATCH] D60363: [clang-format] [PR41170] Break after return type ignored with certain comments positions

MyDeveloperDay via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 6 07:26:58 PDT 2019


MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: klimek, djasper, reuk, russellmcc.
MyDeveloperDay added a project: clang-tools-extra.

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

The AlwaysBreakAfterReturn type setting can go wrong if the line ends with a comment

  void foo() /* comment */

or

  void foo() // comment

It will incorrectly see such functions as Declarations and not Definitions

The following code addresses this by looking for function which end with `; <comment>` rather than just `;` or `<comment>`


https://reviews.llvm.org/D60363

Files:
  clang/lib/Format/TokenAnnotator.h
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60363.194021.patch
Type: text/x-patch
Size: 3529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190406/de1637e8/attachment.bin>


More information about the llvm-commits mailing list