[PATCH] D45927: [clang-tidy] [modernize-use-auto] Correct way to calculate a type name length for multi-token types

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 30 11:32:24 PDT 2018


alexfh added a comment.

In https://reviews.llvm.org/D45927#1083051, @zinovy.nis wrote:

> > I think, it's 13, if you choose to remove stars, and 17 otherwise. The difference is excessive spaces vs. required ones. Implementing proper logic may be involved, but we can simplify it to something like "count all non-space characters and a single space between words, but don't count spaces around punctuation":
>
> Isn't it a business of clang-format to determine the number of spaces between lexemes? IMO the solutuion you've provided for `GetTypeNameLength` is enough. Considering punctuation here is overkill :-)


The algorithm in your patch makes decisions based on the assumption that there may be no spaces at all, which is definitely wrong. I'm proposing an algorithm that would at least handle things like `unsigned char` correctly.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D45927





More information about the cfe-commits mailing list