[PATCH] D93839: [clang-format] PR48594 BraceWrapping: SplitEmptyRecord ignored for templates

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 26 13:05:34 PST 2021


curdeius added a comment.

That's definitely an unintended behaviour. Please file a bug and possibly mark it as release blocker for LLVM 12. Either a fix will be there soon, or we'll revert.

FYI, simple reproduce:

  verifyFormat("#include <stdint.h>\n"
               "namespace rep {}",
               Style);

The problem doesn't happen with `#include "stdint.h"`.



================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:374-375
+        if (Previous) {
+          if (Previous->is(tok::greater))
+            return 0;
+          if (Previous->is(tok::identifier)) {
----------------
@leonardchan, it seems this is the culprit. the closing `>` in the `#include <...>` is treated as if it were a template closer and so it inhibits line merging.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93839



More information about the cfe-commits mailing list