[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-03-20 Thread JJ Marr via cfe-commits
jj-marr wrote: I'm still working on this. It seems like I broke the assertion tests. I'm unsure why, but it should be fixed if I figure out a better way of evaluating the macro. https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-04-17 Thread JJ Marr via cfe-commits
https://github.com/jj-marr converted_to_draft https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-04-29 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 >From d06c5ab5c30e535893335af798df339b0e9c6878 Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Sat, 8 Mar 2025 22:00:45 -0500 Subject: [PATCH] Explain which assertion failed during consteval --- .../clang/Basic/D

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-03-08 Thread JJ Marr via cfe-commits
https://github.com/jj-marr created https://github.com/llvm/llvm-project/pull/130458 Take this piece of code: ```cpp #include consteval int square(int x) { int result = x * x; assert(result == 42); return result; } void test() { auto val = square(2); } ``` The assertion will fail, and

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-03-08 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 >From d61892d8546944000118ad0312886da75cd6509b Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Sat, 8 Mar 2025 22:00:45 -0500 Subject: [PATCH] Explain which assertion failed during consteval --- .../clang/Basic/D

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-03-10 Thread JJ Marr via cfe-commits
@@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -std=c++23 -verify=expected,cxx20_plus %s + +#ifdef __ASSERT_FUNCTION +#undef __ASSERT_FUNCTION +#endif +extern "C" void __assert_fail(const char*, const char*, unsigned, const char*); + +#define assert(cond) \ + ((cond) ? (void)0 : __assert_f

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-04-04 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 >From 0cba377eb8693657b7688cd1feb1cc9c5734f307 Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Sat, 8 Mar 2025 22:00:45 -0500 Subject: [PATCH] Explain which assertion failed during consteval --- .../clang/Basic/D

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-09 Thread JJ Marr via cfe-commits
https://github.com/jj-marr ready_for_review https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-09 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-s

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-09 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 >From 3b6d28e4f74c1fda73abe3b5972d5ac2a43576de Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Sat, 8 Mar 2025 22:00:45 -0500 Subject: [PATCH] Explain which assertion failed during consteval --- clang/docs/Releas

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-09 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-s

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-10 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-s

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-10 Thread JJ Marr via cfe-commits
@@ -5975,9 +5975,15 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc, Definition->hasAttr( return true; - if (Info.getLangOpts().CPlusPlus11) { -const FunctionDecl *DiagDecl = Definition ? Defin

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-09 Thread JJ Marr via cfe-commits
jj-marr wrote: > LGTM modulo nit. > > Are you happy with the current state? @cor3ntin @Sirraide Shouldn't CI be passing? I can't figure out why there are failures. https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-comm

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-09 Thread JJ Marr via cfe-commits
@@ -5975,9 +5975,15 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc, Definition->hasAttr( return true; - if (Info.getLangOpts().CPlusPlus11) { -const FunctionDecl *DiagDecl = Definition ? Defin

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-11 Thread JJ Marr via cfe-commits
@@ -5975,9 +5975,22 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc, Definition->hasAttr( return true; - if (Info.getLangOpts().CPlusPlus11) { -const FunctionDecl *DiagDecl = Definition ? Defin

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-12 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-s

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-13 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 >From 64eb62576dc1ecf0e696f2448e410c2fd77575de Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Sat, 8 Mar 2025 22:00:45 -0500 Subject: [PATCH] Explain which assertion failed during consteval --- clang/docs/Releas

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-13 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 >From 67984fbf0374fa40fd7b73431b17baddc301290f Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Sat, 8 Mar 2025 22:00:45 -0500 Subject: [PATCH] Explain which assertion failed during consteval --- clang/docs/Releas

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-13 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/130458 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-s

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-13 Thread JJ Marr via cfe-commits
jj-marr wrote: > @jj-marr Thanks. Do you want us to merge that for you? Is it something I can actually do myself? https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

2025-05-13 Thread JJ Marr via cfe-commits
jj-marr wrote: OK, merge whenever. https://github.com/llvm/llvm-project/pull/130458 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add modernize-use-span linter check (PR #140001)

2025-05-20 Thread JJ Marr via cfe-commits
jj-marr wrote: Thinking more, this is not a good check at this time. https://github.com/llvm/llvm-project/pull/140001 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add modernize-use-span linter check (PR #140001)

2025-05-20 Thread JJ Marr via cfe-commits
https://github.com/jj-marr closed https://github.com/llvm/llvm-project/pull/140001 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Add modernize-use-span linter check (PR #140001)

2025-05-19 Thread JJ Marr via cfe-commits
jj-marr wrote: `std::span` has a capability gap with a const reference to a `std::vector` until C++26 as `std::span` cannot be constructed from an initializer list. Should this be a C++26 check? https://github.com/llvm/llvm-project/pull/140001 ___ c

[clang] [clang][bytecode] Diagnose failed constexpr assertions differently (PR #140000)

2025-05-15 Thread JJ Marr via cfe-commits
@@ -851,6 +851,19 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) { if (F->isLambdaStaticInvoker()) return true; + // Diagnose failed assertions specially. + if (S.Current->getLocation(OpPC).isMacroID() && + F->getDecl()->getIdentifier()) {

[clang] [clang][bytecode] Diagnose failed constexpr assertions differently (PR #140000)

2025-05-15 Thread JJ Marr via cfe-commits
https://github.com/jj-marr edited https://github.com/llvm/llvm-project/pull/14 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-07-03 Thread JJ Marr via cfe-commits
jj-marr wrote: @vbvictor It makes sense to provide an autofix for `float`/`double`, since I have never heard of them being anything other than IEEE754 32-bit binary floats or IEEE754 64-bit binary floats respectively. `char8_t` will always be `unsigned char` so a fix from `unsigned char` to `

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

2025-07-03 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/146970 >From 3ef4feb748551806c863529306fefb2bd914e5be Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Thu, 3 Jul 2025 17:17:06 -0400 Subject: [PATCH 1/6] AvoidFundamentalIntegerTypesCheck --- .../AvoidFundamentalInteger

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

2025-07-03 Thread JJ Marr via cfe-commits
https://github.com/jj-marr edited https://github.com/llvm/llvm-project/pull/146970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-07-03 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/146970 >From 3ef4feb748551806c863529306fefb2bd914e5be Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Thu, 3 Jul 2025 17:17:06 -0400 Subject: [PATCH 1/8] AvoidFundamentalIntegerTypesCheck --- .../AvoidFundamentalInteger

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

2025-07-03 Thread JJ Marr via cfe-commits
@@ -0,0 +1,181 @@ +//===--- AvoidFundamentalIntegerTypesCheck.cpp - clang-tidy ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

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

2025-07-03 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/146970 >From 3ef4feb748551806c863529306fefb2bd914e5be Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Thu, 3 Jul 2025 17:17:06 -0400 Subject: [PATCH 1/9] AvoidFundamentalIntegerTypesCheck --- .../AvoidFundamentalInteger

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

2025-07-03 Thread JJ Marr via cfe-commits
jj-marr wrote: I will add the `float` component of the check tomorrow. https://github.com/llvm/llvm-project/pull/146970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-07-05 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/146970 >From 3ef4feb748551806c863529306fefb2bd914e5be Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Thu, 3 Jul 2025 17:17:06 -0400 Subject: [PATCH 01/10] AvoidFundamentalIntegerTypesCheck --- .../AvoidFundamentalInteg

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

2025-07-05 Thread JJ Marr via cfe-commits
https://github.com/jj-marr updated https://github.com/llvm/llvm-project/pull/146970 >From 3ef4feb748551806c863529306fefb2bd914e5be Mon Sep 17 00:00:00 2001 From: JJ Marr Date: Thu, 3 Jul 2025 17:17:06 -0400 Subject: [PATCH 01/14] AvoidFundamentalIntegerTypesCheck --- .../AvoidFundamentalInteg

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

2025-07-05 Thread JJ Marr via cfe-commits
@@ -0,0 +1,43 @@ +//===--- AvoidPlatformSpecificFundamentalTypesCheck.h - clang-tidy ---*- C++ +//-*-===// jj-marr wrote: Done. https://github.com/llvm/llvm-project/pull/146970 ___ cfe-commits mailing list cfe-com

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

2025-07-05 Thread JJ Marr via cfe-commits
@@ -0,0 +1,111 @@ +.. title:: clang-tidy - portability-avoid-platform-specific-fundamental-types + +portability-avoid-platform-specific-fundamental-types += + +Finds fundamental types and recommends using typedefs or fixed-width

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

2025-07-05 Thread JJ Marr via cfe-commits
https://github.com/jj-marr edited https://github.com/llvm/llvm-project/pull/146970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-07-05 Thread JJ Marr via cfe-commits
https://github.com/jj-marr edited https://github.com/llvm/llvm-project/pull/146970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-07-05 Thread JJ Marr via cfe-commits
https://github.com/jj-marr edited https://github.com/llvm/llvm-project/pull/146970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-07-04 Thread JJ Marr via cfe-commits
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'

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

2025-07-05 Thread JJ Marr via cfe-commits
@@ -0,0 +1,43 @@ +//===--- AvoidPlatformSpecificFundamentalTypesCheck.h - clang-tidy ---*- C++ +//-*-===// jj-marr wrote: This requires turning off `clang-format` since line 1 is too long. https://github.com/llvm/llvm-project/pull/146970 ___

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

2025-07-05 Thread JJ Marr via cfe-commits
https://github.com/jj-marr edited https://github.com/llvm/llvm-project/pull/146970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-07-05 Thread JJ Marr via cfe-commits
jj-marr wrote: > You could make a universal option to configure autofixes. Make > semicolon-separated list of key-value pairs, e.g. > `int=int32_t;float=float32_t;char=char8_t`. User could specify any type he > wants, and remove/add fixes for `int`, `char` and so on. > > By default, we co

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

2025-07-05 Thread JJ Marr via cfe-commits
@@ -0,0 +1,246 @@ +//===--- AvoidPlatformSpecificFundamentalTypesCheck.cpp - clang-tidy --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

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

2025-07-05 Thread JJ Marr via cfe-commits
https://github.com/jj-marr commented: comments for myself https://github.com/llvm/llvm-project/pull/146970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-07-05 Thread JJ Marr via cfe-commits
https://github.com/jj-marr edited https://github.com/llvm/llvm-project/pull/146970 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-07-05 Thread JJ Marr via cfe-commits
@@ -0,0 +1,246 @@ +//===--- AvoidPlatformSpecificFundamentalTypesCheck.cpp - clang-tidy --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,260 @@ +//===--- AvoidPlatformSpecificFundamentalTypesCheck.cpp - clang-tidy --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

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

2025-07-06 Thread JJ Marr via cfe-commits
jj-marr wrote: > Please remove unnecessary comments that tell the same as code itself, > speaking mostly about comments in `registerMatchers`. They mostly don't give > any more information that matchers themselves. To be honest, this is because I coded 98% of this with AI (except for the `.rs

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,52 @@ +//==-- AvoidPlatformSpecificFundamentalTypesCheck.h - clang-tidy -*- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang-tools-extra] [clang-tidy] Add modernize-avoid-fundamental-integer-types (PR #146970)

2025-07-03 Thread JJ Marr via cfe-commits
https://github.com/jj-marr created https://github.com/llvm/llvm-project/pull/146970 The fundamental types are widely recognized to be flawed because they're of implementation-defined sizes without a common purpose. For example, `long int` is a footgun since its 32 bits on Windows and 64 bits

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,100 @@ +// RUN: %check_clang_tidy %s portability-avoid-platform-specific-fundamental-types %t -- -config="{CheckOptions: [{key: portability-avoid-platform-specific-fundamental-types.WarnOnFloats, value: true}]}" -header-filter=.* -- -std=c++23 + +// Mock fixed-width

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,190 @@ +.. title:: clang-tidy - portability-avoid-platform-specific-fundamental-types + +portability-avoid-platform-specific-fundamental-types += + +Finds fundamental types (e.g. `int`, `float`) and recommends using ty

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,190 @@ +.. title:: clang-tidy - portability-avoid-platform-specific-fundamental-types + +portability-avoid-platform-specific-fundamental-types += + +Finds fundamental types (e.g. `int`, `float`) and recommends using ty

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,190 @@ +.. title:: clang-tidy - portability-avoid-platform-specific-fundamental-types + +portability-avoid-platform-specific-fundamental-types += + +Finds fundamental types (e.g. `int`, `float`) and recommends using ty

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,63 @@ +// RUN: %check_clang_tidy %s portability-avoid-platform-specific-fundamental-types %t -- -config="{CheckOptions: [{key: portability-avoid-platform-specific-fundamental-types.WarnOnChars, value: true}]}" -header-filter=.* -- -std=c++11 jj-marr

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,100 @@ +// RUN: %check_clang_tidy %s portability-avoid-platform-specific-fundamental-types %t -- -config="{CheckOptions: [{key: portability-avoid-platform-specific-fundamental-types.WarnOnFloats, value: true}]}" -header-filter=.* -- -std=c++23 + +// Mock fixed-width

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,190 @@ +.. title:: clang-tidy - portability-avoid-platform-specific-fundamental-types + +portability-avoid-platform-specific-fundamental-types += + +Finds fundamental types (e.g. `int`, `float`) and recommends using ty

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,260 @@ +//===--- AvoidPlatformSpecificFundamentalTypesCheck.cpp - clang-tidy --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,54 @@ +// clang-format off +//===--- AvoidPlatformSpecificFundamentalTypesCheck.h - clang-tidy -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX

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

2025-07-06 Thread JJ Marr via cfe-commits
@@ -0,0 +1,54 @@ +// clang-format off +//===--- AvoidPlatformSpecificFundamentalTypesCheck.h - clang-tidy -*- C++ -*-===// jj-marr wrote: Done. https://github.com/llvm/llvm-project/pull/146970 ___ cfe-commits mailing

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

2025-07-04 Thread JJ Marr via cfe-commits
jj-marr wrote: > Check makes sense to me! As a first iteration it's fine without autofix but I > can imagine it will be hard for a codebase to enable this check given the > large amount of things to fix. Maybe users can specify a mapping of wanted > types via an option? I'm planning for an au

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

2025-07-10 Thread JJ Marr via cfe-commits
@@ -0,0 +1,260 @@ +//===--- AvoidPlatformSpecificFundamentalTypesCheck.cpp - clang-tidy --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap