<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/108356>108356</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-format 18 adds spaces for Q_EMIT when signal is emitted on return value of expressions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
alex1701c
</td>
</tr>
</table>
<pre>
Should state and result of clang-format17 and below:
```cpp
int main()
{
Q_EMIT someMethod()->notifyMe();
}
```
clang-format-18:
```cpp
int main()
{
Q_EMIT someMethod() -> notifyMe();
}
```
The following code would be formatted correctly
```cpp
int main()
{
Q_EMIT(someMethod()->singal());
}
```
The weirdest part is: `clang-format-18 -i example_format.cpp` causes the bad behavior. git-clang-format-18 however does it correctly!
```ini
---
# SPDX-FileCopyrightText: 2019 Christoph Cullmann <cullmann@kde.org>
# SPDX-FileCopyrightText: 2019 Gernot Gebhard <gebhard@absint.com>
#
# SPDX-License-Identifier: MIT
# This file got automatically created by ECM, do not edit
# See https://clang.llvm.org/docs/ClangFormatStyleOptions.html for the config options
# and https://community.kde.org/Policies/Frameworks_Coding_Style#Clang-format_automatic_code_formatting
# for clang-format tips & tricks
---
Language: JavaScript
DisableFormat: true
---
# Style for C++
Language: Cpp
# base is WebKit coding style: https://webkit.org/code-style-guidelines/
# below are only things set that diverge from this style!
BasedOnStyle: WebKit
# enforce C++11 (e.g. for std::vector<std::vector<lala>>
Standard: Cpp11
# 4 spaces indent
TabWidth: 4
# 2 * 80 wide lines
ColumnLimit: 160
# sort includes inside line separated groups
SortIncludes: true
# break before braces on function, namespace and class definitions.
BreakBeforeBraces: Linux
# CrlInstruction *a;
PointerAlignment: Right
# horizontally aligns arguments after an open bracket.
AlignAfterOpenBracket: Align
# don't move all parameters to new line
AllowAllParametersOfDeclarationOnNextLine: false
# no single line functions
AllowShortFunctionsOnASingleLine: None
# always break before you encounter multi line strings
AlwaysBreakBeforeMultilineStrings: true
# don't move arguments to own lines if they are not all on the same
BinPackArguments: false
# don't move parameters to own lines if they are not all on the same
BinPackParameters: false
# In case we have an if statement with multiple lines the operator should be at the beginning of the line
# but we do not want to break assignments
BreakBeforeBinaryOperators: NonAssignment
# format C++11 braced lists like function calls
Cpp11BracedListStyle: true
# do not put a space before C++11 braced lists
SpaceBeforeCpp11BracedList: false
# remove empty lines
KeepEmptyLinesAtTheStartOfBlocks: false
# no namespace indentation to keep indent level low
NamespaceIndentation: None
# we use template< without space.
SpaceAfterTemplateKeyword: false
# Always break after template declaration
AlwaysBreakTemplateDeclarations: true
# macros for which the opening brace stays attached.
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE , wl_resource_for_each, wl_resource_for_each_safe ]
# keep lambda formatting multi-line if not empty
AllowShortLambdasOnASingleLine: Empty
# We do not want clang-format to put all arguments on a new line
AllowAllArgumentsOnNextLine: false
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysWF1v6jwS_jXhZgTKB7T0ggug8L7d05a-h2rP3iEnmSTeOnZkO6Tsr1-Nk5RA29Xu0UroHHBm5pnPx5MyY3guERfebOXN7kestoXSCybwPbj1g2QUq_S02BeqFikYyywCkyloNLWwoDJIBJP5OFO6ZDa4dQ9jFKrxoqXn33t-_--N336SqmpPuLRQMi69cO6Fd53U7ar9AgDw12Hz9PAKRpX4hLZQaSs59qKNVJZnpyfsdKNVr35_hTZ0YejpOJifHfy_uQbkG_yWc68FQqaEUA2XOSQqRWhczmM6J5ctppAorTGx4vR7nrdue-H8q5waLnMmOsX_ye8GuU7RWKiYtsCNFy2BnLrMN4w54DsrK4GH9nBCbt_4kLDaoAFbIMSMIi7YkSs9gZzb8bWVQjV4RA2pQgPcDlISBl82HJe8PRmPx92jMIL9y_0_xlsucK2qk-Z5YV_x3ZLnoR_cwbrQ3FhVFbCuhSiZlOBF66T77k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