[PATCH] D117142: [clang-format] Fix short functions being considered as inline inside an indented namespace.
Marek Kurdej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 12 12:25:15 PST 2022
curdeius created this revision.
curdeius added reviewers: MyDeveloperDay, HazardyKnusperkeks, owenpan.
curdeius requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Fixes https://github.com/llvm/llvm-project/issues/24784.
With config:
AllowShortFunctionsOnASingleLine: Inline
NamespaceIndentation: All
The code:
namespace Test
{
void f()
{
return;
}
}
was incorrectly formatted to:
namespace Test
{
void f() { return; }
}
since the function `f` was considered being inside a class/struct/record.
That's because the check was simplistic and only checked for a non-zero indentation level of the line starting `f`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117142
Files:
clang/lib/Format/UnwrappedLineFormatter.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/FormatTestCSharp.cpp
clang/unittests/Format/FormatTestJava.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117142.399421.patch
Type: text/x-patch
Size: 8031 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220112/212d751b/attachment.bin>
More information about the cfe-commits
mailing list