[PATCH] D114521: [clang-format] [PR47936] AfterControlStatement: MultiLine breaks AllowShortFunctionsOnASingleLine
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 24 07:27:16 PST 2021
MyDeveloperDay added a comment.
In D114521#3151431 <https://reviews.llvm.org/D114521#3151431>, @curdeius wrote:
> LGTM, but I have one question. You mentioned in the bug ticket comment that "this exposes a greater issue in AllowShortXXX". Have you found other cases that misbehave? If so, then it would probably be good to add them.
So when I took a look I think I stumbled on what @KyrBoh said below, but I'm not convinced its related. (so really want to deal with this separately)
What it seems is "AllowShortIfStatementsOnASingleLine" ONLY seems to work when there are no `{}` (this seems to be by design https://clang.llvm.org/docs/ClangFormatStyleOptions.html)
i.e. for
BasedOnStyle: LLVM
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
ColumnLimit: 80
I get
class Foo {
foo() {
if (x) bar();
if (x) {
bar();
}
}
};
So I think that was just me not understanding that limitation, (although I agree it doesn't seem to follow other options of a similar name)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114521/new/
https://reviews.llvm.org/D114521
More information about the cfe-commits
mailing list