[PATCH] D44765: PR36643 Make clang-format support more generic TMarcos

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 23 08:31:21 PDT 2018


alexfh added a comment.

In https://reviews.llvm.org/D44765#1045789, @obfuscated wrote:

> In https://reviews.llvm.org/D44765#1045373, @alexfh wrote:
>
> > We can't just treat `anything("....")` like the _T macro. There should be a whitelist configurable with an option. By default only _T should be handled.
>
>
> What cases could break with this version of the patch?


It is fine to split `_T("veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeery loooooooooooooooooooooooooooong striiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing")` as

  _T("veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeery ")
  _T("loooooooooooooooooooooooooooong ")
  _T("striiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing")

and it's incorrect to split it like this:

  _T("veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeery "
     "loooooooooooooooooooooooooooong "
     "striiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing")

since only the first string literal will get the L prefix in case when `_T(x)` is defined as `L ## x`. The same is valid for `wxT()` as I understand.

However, it's wrong to do so for any function or any macro which uses its argument in any way different from that of _T. E.g. `strlen("aaa bbb")` is not the same as

  strlen("aaa ")
  strlen("bbb")



> I'm fine adding an option if this is deemed acceptable.

I'd say this should be an option.


Repository:
  rC Clang

https://reviews.llvm.org/D44765





More information about the cfe-commits mailing list