[PATCH] D120931: [clang-format] Fix namespace format when the name is a macro expansion

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 4 10:31:55 PST 2022


MyDeveloperDay added inline comments.


================
Comment at: clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp:112
+  EXPECT_EQ("#define M(x) x##x\n"
+            "namespace [[deprecated(\"foo\")]] A::inline M(x)::A {\n"
+            "int i;\n"
----------------
Is this 2 bugs in one? I notice  you also handling attributes? is this a different bug? (if so it should really be separate  (but we can let it slide as long as the tests are thorough)

can you test:

```
namespace /* comment  */ [[ xxx ]]  /* comment */  A {
int i;
int j;
}  // namespace  A

namespace /* comment  */ [[ xxx ]]   A {
int i;
int j;
}  //  namespace A

namespace /* comment  */ [[ xxx ]]   /* comment */ M(x) {
int i;
int j;
}  // namespace  M(x)

namespace /* comment  */ [[ xxx ]]   /* comment */  A::M(x) {
int i;
int j;
}  // namespace  A::M(x)

namespace /* comment  */ [[ xxx ]]   /* comment */ M(x)  /* comment */ {
int i;
int j;
}  // namespace  M(x)  

namespace /* comment  */ [[ xxx ]]   /* comment */  A::M(x) /* comment */  {
int i;
int j;
}  // namespace  A::M(x)
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120931/new/

https://reviews.llvm.org/D120931



More information about the cfe-commits mailing list