[PATCH] D117142: [clang-format] Fix short functions being considered as inline inside an indented namespace.

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 13 02:08:34 PST 2022


curdeius marked 2 inline comments as done.
curdeius added inline comments.


================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:297
+                  return true;
+                if (Style.isCpp() && RecordTok->is(tok::kw_union))
+                  return true;
----------------
HazardyKnusperkeks wrote:
> Is union used in another language and behaves then differently?
At least in C#, `union` is not a keyword and can be e.g. a name of a namespace. There's a test for this.


================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:304
+                  return true;
+                if (Style.isJavaScript() && RecordTok->is(Keywords.kw_function))
+                  return true;
----------------
HazardyKnusperkeks wrote:
> Is there a test for that?
Yes, there were existing tests in https://github.com/llvm/llvm-project/blob/main/clang/unittests/Format/FormatTestJS.cpp#L993 at least.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117142



More information about the cfe-commits mailing list