[cfe-dev] clang-format: Problem with BreakBeforeBinaryOperators
David Barto via cfe-dev
cfe-dev at lists.llvm.org
Wed Jul 17 08:01:07 PDT 2019
(Possibly wrong mailing list?)
I'm trying to get the formatting for binary operators and constructor arguments the way our group would like it. Currently the style is based on llvm. For operator alignment it currently returns:
bool Derived::equals(const Base *n)
{
if (false == Base::equals(n))
return false;
Derived *an = ( Derived * )n;
return (m_num_nodes == an->m_num_nodes && m_num_slices == an->m_num_slices &&
m_num_nodeslices == an->m_num_nodeslices && m_is_selstar == an->m_is_selstar);
}
We would prefer it return the following:
bool Derived::equals(const Base *n)
{
if (false == Base::equals(n))
return false;
Derived *an = (Derived *)n;
return (m_num_nodes == an->m_num_nodes &&
m_num_slices == an->m_num_slices &&
m_num_nodeslices == an->m_num_nodeslices &&
m_is_selstar == an->m_is_selstar);
}
What is interesting is that the preferred output is almost correct if I use -style=none. But some details about curly-brace locating don't match. The full style is at the end of this message.
The alignment we would prefer for function arguments is to have 1 per line, with a leading ','. Based on LLVM
We have
inline
void Mgr::retag
/// Helper method to request retagging of an address range rather than a
/// base and count.
( void* base ///< Huge page aligned range begin
, void* end ///< Randomly aligned range end
, qx::TxTag newTag ///< New tag (to be assigned)
)
But the formatter does this. Again -style=none doesn't have the problem.
inline void Mgr::deallocate
/// Helper method to request freeing of an address range rather than a
/// base and count.
(void *base ///< Huge page aligned range begin
,
void *end ///< Randomly aligned range end
,
bool noError ///< Crux of the _one-shot_ mechanism
)
If I could get guidance on how to set switches for these 2 options it would go a long way in getting our code.
CSI.CSI <http://clang-developers.42468.n3.nabble.com/file/t497788/CSI.CSI>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190717/1b5a1a30/attachment.html>
More information about the cfe-dev
mailing list