[PATCH] D33440: clang-format: properly handle Q_UNUSED and QT_REQUIRE_VERSION

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 05:47:05 PDT 2017


Typz added a comment.

Digging back, it seem the issue was that I had this code:

  void foo(......) { Q_UNUSED(a) Q_UNUSED(b) }

which got wrapped because the line was too long:

  void foo(......) {
    Q_UNUSED(a) Q_UNUSED(b)
  }

I definitely understand your concern about introduceing special handling for some specific/hard-coded macro-DSLs, but would it be acceptable to add a configuration option to specify a list of such macros? e.g. a StatementMacros option, similar to the ForEachMacros option?

That would allow:

- Systematically reformatting the first example
- If  such a code is reformatted, ensure the 2 macros are not on the same line


https://reviews.llvm.org/D33440





More information about the cfe-commits mailing list