[PATCH] D118337: [clang-format] Fix AllowShortFunctionsOnASingleLine: InlineOnly with wrapping after record.

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 27 03:31:08 PST 2022


curdeius added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:280
+            if (Style.isJavaScript() && (*I)->Last->is(TT_FunctionLBrace))
+              return true;
+
----------------
MyDeveloperDay wrote:
> we didn't need this anymore?
Before it was handled in:
```
if (Style.isJavaScript() && RecordTok->is(Keywords.kw_function))
                  return true;
```


================
Comment at: clang/unittests/Format/FormatTest.cpp:12348-12360
+  verifyFormat("struct C\n"
+               "// comment\n"
+               "/* comment */\n"
+               "// comment\n"
+               "{\n"
+               "  int f() { return 42; }\n"
+               "};",
----------------
I know that some of these tests look weird but these were failing cases with a previous approach.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118337



More information about the cfe-commits mailing list