<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62658>62658</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Chained calls / preprocessor sequences
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ecatmur
</td>
</tr>
</table>
<pre>
Some libraries e.g. Boost.ProgramOptions, Boost.Assign, Boost.Test use a syntax of what looks like chained calls; sometimes this is actual calls to an `operator()`, sometimes it is a preprocessor construct https://www.boost.org/doc/libs/1_81_0/libs/preprocessor/doc/data/sequences.html:
```c++
desc.add_options()
("help", "output usage")
("inputDirectory", po::value<boost::filesystem::path>()->required(), "The input path")
("outputDirectory", po::value<boost::filesystem::path>()->required(), "The output path");
group2 = boost::assign::list_of<score_pair>
("Norway", list_of(1)(0))
("USA", list_of(0)(0))
("Andorra", list_of(1)(1));
BOOST_WARN_PREDICATE(moo,
(12)
(std::string("a string that is long enough to force this argument onto its own line"))
(j));
QUICKBOOK_VALUE_TAGS(block_tags, 0x200,
(begin_section)(end_section)
(generic_heading)
(heading1)(heading2)(heading3)(heading4)(heading5)(heading6)
(blurb)(blockquote)(preformatted)
(warning)(caution)(important)(note)(tip)(block)
(macro_definition)(template_definition)
(variable_list)(table)
(xinclude)(import)(include)
(paragraph)(paragraph_in_list)
(ordered_list)(itemized_list)
(hr)
)
```
Currently this is formatted as:
```c++
desc.add_options()("help", "output usage")(
"inputDirectory", po::value<boost::filesystem::path>()->required(),
"The input path")("outputDirectory",
po::value<boost::filesystem::path>()->required(),
"The output path");
group2 = boost::assign::list_of<score_pair>("Norway", list_of(1)(0))(
"USA", list_of(0)(0))("Andorra", list_of(1)(1));
BOOST_WARN_PREDICATE(
moo,
(12)(std::string("a string that is long enough to force this argument "
"onto its own line"))(j));
QUICKBOOK_VALUE_TAGS(block_tags,
0x200, (begin_section)(end_section)(generic_heading)(heading1)(heading2)(heading3)(heading4)(heading5)(heading6)(blurb)(blockquote)(preformatted)(warning)(caution)(important)(note)(tip)(block)(macro_definition)(template_definition)(variable_list)(table)(xinclude)(import)(include)(paragraph)(paragraph_in_list)(ordered_list)(itemized_list)(hr))
```
Since each "call" is a separate item, it would be better to break between `)(` pairs.
A workaround (https://stackoverflow.com/a/68476862/567292) is to add an empty C++ comment `//` after (some) items.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8V1Fz2jgQ_jXiRRPGlsGBBx4IhJtOb5pek949emRpsdXIkiutQ3O__ka2AZOSHr1ryzDAStrdb1e7H17uvSoMwIJMb8h0PeINltYtQHCsGjfKrXxe3NsKqFa5406BpzAuxvTGWo_j984Wjld3NSprPGGrfn3ZWj3KD-CRNh4op_7ZIP9C7ZbuSo5UW_voqVaPQEXJlQFJBdfak-SGelsBqgo8xVJ5qjzlAhuuuxMULeWGkjSyNTiO1hE2I2xO0ig4PiorbFVp7aB2VoD31lFhjUfXCKQlYu1JsiRsQ9hmt9uN8xazdQVhG2kFYRutck_YJs5mcRYd5aHFw1nJkRO28fC5ASPAj0usdLAfrUm0_0yj7i0IuwnvdpVK8GLMpczsPqFtQN1m_2rXWAm6JoyFQAljtsG6CQnmBbSre53usDJ1g2vlQKB1z71abQOmZPnEdQMkWbVBd0tbpcE_e4Sqk2uOJUluOzRXJLl18LlRDmSPrwPxUAJtPdH2_BDGCfQO7C-B0-dlgCfZp7pwtqkZJcmaDlx13dD91spjZrckWXlhHWQ1Vy64PRPSO-t2fB_JXo_N4hbNLGq_zubi4_3yK63oX7WWRlrn-Gv-4l7zECul9Obu7v4h-2v54V32_sPt-s1q-RASWFlL2OorH_FpCXmUXUo8OmWKDgSnnUQxtLHyVFtTUDC2KcrQmlvrBHSNy13RVGCQWoOWKvTU7gzVyuyL9UyYn84E8cfHN6u3N3d3b7M_l79_vM0elr_dEzbLtRWPGfKiJaDoC4uic0HlUCiTeRChtbpMgZHDh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