[clang] [clang-format] Fix bad indentation with attribute and templated type (PR #76336)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 28 22:52:48 PST 2023


================
@@ -26492,6 +26492,10 @@ TEST_F(FormatTest, BreakAfterAttributes) {
   verifyFormat("[[nodiscard]]\n"
                "Foo& operator-(Foo&);",
                Style);
+
+  verifyFormat("[[maybe_unused]]\n"
+               "foo<int> f;",
+               Style);
----------------
owenca wrote:

Please move it up and insert it into `Code`:
```
  constexpr StringRef Code("[[maybe_unused]] const int i;\n"
                           "[[foo([[]])]] [[maybe_unused]]\n"
                           "int j;\n"
                           "[[maybe_unused]]\n"
                           "foo<int> k;\n"
                           "[[nodiscard]] inline int f(int &i);\n"
```
and update the test cases for `ABS_Never` and `ABS_Always`.

https://github.com/llvm/llvm-project/pull/76336


More information about the cfe-commits mailing list