[PATCH] D107961: [clang-format] Distinguish K&R C function definition and attribute
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 13 01:17:07 PDT 2021
owenpan added a comment.
In D107961#2943223 <https://reviews.llvm.org/D107961#2943223>, @MyDeveloperDay wrote:
> Did the original change make it into the 13 branch?
What's //the 13 branch//?
> I'm seeing some unexpected behavior.
>
> bool foo(int a, Bar) override;
> bool foo(int a, Bar) override; // comment
>
> becomes
>
> bool foo(int a, Bar)
> override;
> bool foo(int a, Bar)
> override; // comment
How can I reproduce it? The above C++ declarations should be inside a class definition, no?
Anyway, here is what I got:
$ cat .clang-format
BasedOnStyle: LLVM
AlwaysBreakAfterReturnType: TopLevelDefinitions
$ cat foo.cpp
typedef float Bar;
class A {
virtual bool foo(int, Bar);
virtual bool bar(int, Bar);
};
class B : A {
bool foo(int a, Bar) override;
bool bar(int a, Bar) override; // comment
};
$ clang -Wall -std=c++11 -c foo.cpp
$ clang-format foo.cpp > bar.cpp
$ diff foo.cpp bar.cpp
$
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107961/new/
https://reviews.llvm.org/D107961
More information about the cfe-commits
mailing list