<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/87507>87507</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Macros styling option parses code not like expanded (ignores access modifier offset)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          CDMartinL
      </td>
    </tr>
</table>

<pre>
    # Environment
The tested v19 clang-format executable was built from latest source of 13.03.2024. Also tested with clang-format 17.0.3.

Setting in .clang-format is:
```
Language: Cpp
AccessModifierOffset: -2
Macros:
  - PUBLIC4UTEST(a)=a
```

# Problem
```
#if COMPILED_FOR_UTEST
#define PUBLIC4UTEST(vis_in_production_code) public
#else
#define PUBLIC4UTEST(vis_in_production_code) vis_in_production_code
#endif

class A {
PUBLIC4UTEST(private):
  void method_I_want_to_access_form_unittest();

public:
  void other_public_methods();
};
```

formats to

```
#if COMPILED_FOR_UTEST
#define PUBLIC4UTEST(vis_in_production_code) public
#else
#define PUBLIC4UTEST(vis_in_production_code) vis_in_production_code
#endif

class A {
 PUBLIC4UTEST(private):
  void method_I_want_to_access_form_unittest();

public:
  void other_public_methods();
};

```

The `Macros` styling option at least prevents the colon from being moved to a new line, but still does not treat the content in such a way that the indentation is not treated like a method/variable.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkVU1vqzoT_jXOZhREDISwYJEmjVSpVav39KyRwQP4vcZG9kBO__0VH6cfUc_mrq50pcgBz8wznnmGx8J71RjEnCV3LDlvxECtdfnp_CQcKfO4Ka18yxmP4N6MylnToSEWnll4fG0RCD2hhHGXQaWFaba1dZ0gwF9YDSRKjXAVHspBaYLa2Q60mGLA28FVCLaGXRSEUcBDHgdw1N7-xrwqar-C7tIgDKJgyb6sP5BImQaUgeCLr_IsWn3YPlx_8-ujMM0gGmTREU59v2weqwq9f7JS1Qrdc117pMlhyxf7k6ic_YAE2MLLz7vHh1P88_X-xyvjB8F4xqKz-DbnuvIIXpwtNXbfe_FI1XB6fnp5eLw_F5fn_xUL-m-rxFoZvM08Kl8oU_TOyqEiZU1RWYmMZ9APpVbVezhqj_8Y6w-Wd2wjVf252EoL7-EILL1bNm4y9U6NgnDu2ntXR6skdEitlcVDcRWGCrKFmMkpJmaLwSiaBoTxwxx69znnWu8NnqUWXbHYigXc34an54_n76hbpsoD2S-E_pf4u0317yXwzzROksX24fo170Pw9KYn_bD91BIQBBqFJ-gdjmgmwluEymprFvUqcfLu7IgSyIIAg1fQyiDjJygHAk9Ka5AWPRhLQA4FrSCG0NCkVH6oWhBwFW9A7WpWRqIhMZ9CfYpFCVr9hSDWrjJ-GYVTk7IGG5lHMosyscF8l-74LjmEMd-0OSZlshexiDHJEnmoZJVkmKUx7rIo4XG6Ufmkt2EcRruEp5wH-yxM63ofyaSqE7mrWRxiJ5QOtB67wLpmo7wfMD-kSZhutChR-_nK4HzqwGxknE83iMunmG05NJ7FoVae_AcKKdKYL_2_bX4vnEcP01jO9c91469eGIkSGD-oxliHHpZxgm5Va7CLXPNsMzidt0T9rNT8wvilUdQOZVDZjvHLdIz1b9s7-3-siPHLfHjP-GUu7u8AAAD__12TMRg">