<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/142614>142614</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] Different `-Wunused-value` output in preprocessed source code
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
iii-i
</td>
</tr>
</table>
<pre>
Clang reports `-Wunused-value` for the following code:
```
int f(void);
void g(void) { (long)f(); }
```
but not the following:
```
int f(void);
#define MACRO() (long)f()
void g(void) { MACRO(); }
```
This is because `DiagnoseUnused()` calls `S.SourceMgr.isMacroBodyExpansion()`.
This is problematic when one tries to work with preprocessed source code, for example, using `icecc` to build it on a remote machine.
Is there a way to preserve macro expansion information, in order to make `isMacroBodyExpansion()` return identical values for both preprocessed and non-preprocessed source code?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMU1ur4zYQ_jXyy5Agy5ckD37IOWmgD4dCt6XPsjW2pytrjC7Jnn9f5JN2t8umFARBYT59l_GnQ6DJIXaieRHNpdApzuw7ItpR0bN5716tdhN4XNnHAKKVuz-SSwHN7qZtQtFKGNlDnBFGtpbv5CYY2KCozkJup5WPI8_kIoxCHW9MRqiTqF6EPOcLTF__BXF4AaGOlt0k1CnPf8yCOFy-e1DIc58iOI7_lvD_2YWqDI7kEN7Or7_-8kH2A_onOr8BPVX420wBKECPg04Bc4oX0pPjgL9vWT7wrYRBW7vF_Gn_iZMf8G3yewpvevD8wub9py-rdoHY_QPZf0Oweu4tLjrSAPcZHbBDiJ4wQGS4s_8Md4ozrB5XzwOGgAbCxvOxM_W6bRO_6GW12zWFvFDRShpwGLLEyNAnsgYoAjvQ4HHhiLDoYSaHWc_PIW_DI2i46_eMWD0G9LdtyjPg3zaA3Mg-K86WXoEcsDfoM2bRn7es_tM-eIzJOyCDLtKgLWzfZdh89Py9We0MOHa7pwlU18J0lTlVJ11gVx7q46ktj21dzJ3RTVmXRvdVNWKNOB7aSqr-1MujkkafCuqUVI1sZVXWda3q_aFRh0qXjSqlakqjRC1x0WT31t6WPfupoBASdmWt2rIurO7Rhq2LSg25eEKpXEvfZcCuT1MQtbQUYvj6RKRotwJvVRXNBS40jujRxR_3lVNcU8xRP0uhSN52c4xryD1SV6GuE8U59fuBF6Gumfvxs1s9_4lDFOq6eQlCXR92bp36KwAA__8Q42HG">