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

    <tr>
        <th>Summary</th>
        <td>
            Defining anonymous namespace through macro results in invalid formating
        </td>
    </tr>

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

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

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

<pre>
    In our project we have a macro that defines an anonymous namespace, which under some build configs is a named namespace.
We are using clang-format though VS2022 integration.

Here is the small sample I've made as a repro.
This is how code is supposed to look like with "normal" anonymous namespace.
``` cpp
#include <iostream>

#define ANON_NS namespace

struct Foo {};

namespace {
void myFunction(Foo* bla);
}

int main() {
  std::cout << "Hello World!\n";
}
```

And this is what I get with macro version

``` cpp
#include <iostream>

#define ANON_NS namespace

struct Foo {};

ANON_NS{void myFunction(Foo* bla);}

int main() {
  std::cout << "Hello World!\n";
}
```
Here is my .clang-format content used for the sample
```
# Start with pure Chromium
BasedOnStyle: Chromium
NamespaceMacros: ['ANON_NS']
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFVE1v2zAM_TXyhWjgynGdHHzIx4r2sPSQYT0OsizbamXJ0EeC_PtRdrJkQw67FSAS2-R7JB9FVaY-la8aTLAwWPMhuIejgI4dBDDoGbcGfMc81KKRWjhgGs3oU2-CA8164QbGBaEbOHaSdxB0LSw40wuoglQ1cKMb2TqQiB0B9RU2I-mWpKt3zGUFBCd1C1wx3T40xvaY1XcmtB383NOUUpDai9YyL40-I6ffF4Fo5PedANczpcCxflACXgktsJGe1Zgh5rcCmzxjf3RyrKozRyyyHhlcGAbjsERvQBnzCUp-CjhK3wGhVMeiFD7ck-BS0VM6GfBhOH-imdRcBUxBso00zlvBepJ9u-0BgyaJYbV72_3a7W_EvQlDbMARPRsDpFiTYkuy9a3_D2h0j58ORtbQn56D5lE5QheIJnQFlWKELq8ESHbDhGKjcDLGY9SVDsD5mmQrNG6Cjy2hRXlehFIG3o1VNaGPJN8glt6hvyh0m22lUfPzQI7xvL1CK_yk_HQKD8K6WP6tZl-r9RmMvv-Q-GvEvWxGf4LZX4uFW-kFFhHiYcdv0-6MW3N_SjSDvWf2PJIhIO-ms6aXoZ8i1gyp3vTen5AiW_3j3V0E_h6H6WIAyde4nhcRaUHy-z0kdZnVy2zJEi-9EuU2ji7eFHeWENuw440xnRkrXFAeD5VGOzAlx16xf4Qnwaqy836IxRD6jNZia6GacdPji1KHy9_D-WbEV-lcEA4f8qen_DHpymVNxbwpqoYXDeNZTiu2aHiTLShNs8WcJopVQrly7JZqcYSRIg4v3yayjBdbWtDHR5ov8mKWLubZks_pkldFnS8omacCD4qaxTpmxraJLceSqtA6dCrpvLs6mXOy1UKM6ZCfBbxBbTmwgxIfxsnBHCRPxgrKsYPfGxLUGg">