[PATCH] D141058: [clang-tidy] fix wrong fixup for bugprone-implicit-widening-of-multiplication-result

Vincent Hong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 9 05:14:36 PST 2023


v1nh1shungry added a comment.

> Sorry, I'm confused. Could you please explain what you expect this example should achieve and what is "the rule"? Thanks!

Ah, I think I understand it. You mean the `bugprone-implicit-widening-of-multiplication-result` check doesn't warn anything about this example, right?

If so, although I don't understand what you mean by coming up with this example, to classify, when I said

> The second one will turn int64_t into long, which I don't have a good feeling about.

the point is that if we choose to use the desugared type,

  int64_t foobar() {
    return 1024 * 1024;
  }

will change to

  int64_t foobar() {
    return static_cast<long>(1024 * 1024);
                       ^^^^ instead of int64_t
  }

Here I think this will break the portability.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141058



More information about the cfe-commits mailing list