[clang-tools-extra] [clang-tidy] Add portability-avoid-platform-specific-fundamental-types (PR #146970)

JJ Marr via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 4 13:04:10 PDT 2025


jj-marr wrote:

> Have you looked at google-runtime-int? It should be doing the same thing (maybe small differences)

I haven't before now. I still think a new check is necessary. 

`google-runtime-int` isn't as strict because it is coupled to the Google coding guidelines. That means it doesn't flag `int`, `float`, `double`, etc. That behaviour shouldn't change as Google's coding guidelines explicitly recommend using `int` for loop counters as well as `float`, `double` for IEEE754 floats. 

This check will encompass usage of almost all fundamental types that are implementation-defined, including `float`, `double`, `int`, and (potentially) `char`. The main exception is `bool` because it doesn't suffer from the same overflow issues as other types. This is a significant change and goes against Google's coding guidelines. 

https://github.com/llvm/llvm-project/pull/146970


More information about the cfe-commits mailing list