[llvm-bugs] [Bug 52401] New: clang-format Require Clause fails to break correctly when using parenthesis.
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Nov 4 05:23:14 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52401
Bug ID: 52401
Summary: clang-format Require Clause fails to break correctly
when using parenthesis.
Product: clang
Version: 13.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++2a
Assignee: unassignedclangbugs at nondot.org
Reporter: peeceseven at gmail.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
related to: https://bugs.llvm.org/show_bug.cgi?id=32165
It seems to have some basic formatting that works okay as long as you don't use
parenthesis. If I wrap the Requires clause in parenthesis the whole thing and
the following line will be combined into one line. At least in some of my
testing.
I'm using the ClangFormat built into Clion it appears to be ClangFormat 13.
//start without parenthesis
template<
bool nested = true,
typename lambdaT,
typename filterT = decltype(default_filter_lambda)>
requires valid_execute_on_lambda<lambdaT> && valid_filter_lambda<filterT>
bool
execute_on(
const std::initializer_list<std::string_view> &filename,
lambdaT &&lambda,
filterT &&filter_lambda = {}) const
{
return loop(get_execute_on_lambda<nested>(filename, lambda,
filter_lambda));
}
//end without.
//start with
template<
bool nested = true,
typename lambdaT,
typename filterT = decltype(default_filter_lambda)>
requires(valid_execute_on_lambda<lambdaT> &&valid_filter_lambda<filterT>)
bool execute_on(
const std::initializer_list<std::string_view> &filename,
lambdaT &&lambda,
filterT &&filter_lambda = {}) const
{
return loop(get_execute_on_lambda<nested>(filename, lambda,
filter_lambda));
}
//end with
The one below here requires the parathesis because it has two conditions. See
how the function type and function name are forced to be on the same line as
the last condition?
//start another example with two groups of parenthesis
template<
bool nested = true,
ArchiveTypeT... aT,
typename lambdaT,
typename filterT = decltype(default_filter_lambda)>
requires(valid_execute_on_lambda<lambdaT> &&valid_filter_lambda<filterT>)
&& (sizeof...(aT) > 0) bool execute_on(
const std::initializer_list<std::string_view> &filename,
lambdaT &&lambda,
filterT &&filter_lambda = {}) const
{
return specify<aT...>(
get_execute_on_lambda<nested>(filename, lambda, filter_lambda));
}
};
//end of another example.
--
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/20211104/2bd8afcf/attachment.html>
More information about the llvm-bugs
mailing list