[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-03-02 Thread Katherine Whitlock via cfe-commits
@@ -0,0 +1,163 @@ +//===--- UseNumericLimitsCheck.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 new check `readability-use-numeric-limits` (PR #127430)

2025-02-28 Thread Katherine Whitlock via cfe-commits
@@ -0,0 +1,163 @@ +//===--- UseNumericLimitsCheck.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 new check `readability-use-numeric-limits` (PR #127430)

2025-02-28 Thread Katherine Whitlock via cfe-commits
stellar-aria wrote: > What is the expected behavior of `+128` `-127`? I feel like they shouldn't be matched, since with opposite signs they're not really within the set of limits? It just feels unintuitive to me for `-127` to be replaced by something like `-std::numeric_limits::max()`. I've ad

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-28 Thread Katherine Whitlock via cfe-commits
https://github.com/stellar-aria updated https://github.com/llvm/llvm-project/pull/127430 >From ba0eef9808b42b01e356cd5c87745f7477e07c68 Mon Sep 17 00:00:00 2001 From: Katherine Whitlock Date: Sun, 16 Feb 2025 22:45:06 -0500 Subject: [PATCH 01/10] [clang-tidy] Add new check `readability-use-num

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-22 Thread Katherine Whitlock via cfe-commits
@@ -0,0 +1,84 @@ +// RUN: %check_clang_tidy %s readability-use-numeric-limits %t +#include + +void constants() { + // CHECK-MESSAGES: :[[@LINE+2]]:14: warning: The constant -128 is being utilized. Consider using std::numeric_limits::min() instead [readability-use-numeric-limit

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-21 Thread Katherine Whitlock via cfe-commits
@@ -0,0 +1,164 @@ +//===--- UseNumericLimitsCheck.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 new check `readability-use-numeric-limits` (PR #127430)

2025-02-21 Thread Katherine Whitlock via cfe-commits
@@ -0,0 +1,84 @@ +// RUN: %check_clang_tidy %s readability-use-numeric-limits %t +#include + +void constants() { + // CHECK-MESSAGES: :[[@LINE+2]]:14: warning: The constant -128 is being utilized. Consider using std::numeric_limits::min() instead [readability-use-numeric-limit

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-21 Thread Katherine Whitlock via cfe-commits
https://github.com/stellar-aria updated https://github.com/llvm/llvm-project/pull/127430 >From ba0eef9808b42b01e356cd5c87745f7477e07c68 Mon Sep 17 00:00:00 2001 From: Katherine Whitlock Date: Sun, 16 Feb 2025 22:45:06 -0500 Subject: [PATCH 1/7] [clang-tidy] Add new check `readability-use-numer

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-18 Thread Katherine Whitlock via cfe-commits
@@ -0,0 +1,23 @@ +.. title:: clang-tidy - readability-use-numeric-limits + +readability-use-numeric-limits +== + + Replaces certain integer literals with equivalent calls to + ``std::numeric_limits::min()`` or ``std::numeric_limits::max()``. + +Before:

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-18 Thread Katherine Whitlock via cfe-commits
@@ -0,0 +1,41 @@ +//===--- UseNumericLimitsCheck.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 new check `readability-use-numeric-limits` (PR #127430)

2025-02-18 Thread Katherine Whitlock via cfe-commits
https://github.com/stellar-aria updated https://github.com/llvm/llvm-project/pull/127430 >From ba0eef9808b42b01e356cd5c87745f7477e07c68 Mon Sep 17 00:00:00 2001 From: Katherine Whitlock Date: Sun, 16 Feb 2025 22:45:06 -0500 Subject: [PATCH 1/6] [clang-tidy] Add new check `readability-use-numer

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-17 Thread Katherine Whitlock via cfe-commits
@@ -91,6 +91,13 @@ Improvements to clang-tidy New checks ^^ +- New :doc:`readability-use-numeric-limits + ` check. + + Replaces certain integer literals with equivalent calls to stellar-aria wrote: Fixed by matching the doc to this line https://git

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-17 Thread Katherine Whitlock via cfe-commits
https://github.com/stellar-aria updated https://github.com/llvm/llvm-project/pull/127430 >From ba0eef9808b42b01e356cd5c87745f7477e07c68 Mon Sep 17 00:00:00 2001 From: Katherine Whitlock Date: Sun, 16 Feb 2025 22:45:06 -0500 Subject: [PATCH 1/3] [clang-tidy] Add new check `readability-use-numer

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-17 Thread Katherine Whitlock via cfe-commits
@@ -91,6 +91,11 @@ Improvements to clang-tidy New checks ^^ +- New :doc:`readability-use-numeric-limits + ` check to replace certain stellar-aria wrote: Reworded and reformatted to match

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-17 Thread Katherine Whitlock via cfe-commits
https://github.com/stellar-aria updated https://github.com/llvm/llvm-project/pull/127430 >From ba0eef9808b42b01e356cd5c87745f7477e07c68 Mon Sep 17 00:00:00 2001 From: Katherine Whitlock Date: Sun, 16 Feb 2025 22:45:06 -0500 Subject: [PATCH 1/2] [clang-tidy] Add new check `readability-use-numer

[clang-tools-extra] [clang-tidy] Add new check `readability-use-numeric-limits` (PR #127430)

2025-02-16 Thread Katherine Whitlock via cfe-commits
https://github.com/stellar-aria created https://github.com/llvm/llvm-project/pull/127430 The adds a check that replaces specific numeric literals like `32767` with the equivalent call to `std::numeric_limits` (such as `std::numeric_limits::max())`. Partially addresses #34434, but notably does

[clang] Reland Print library module manifest path again (PR #84881)

2024-03-19 Thread Katherine Whitlock via cfe-commits
stellar-aria wrote: Can we also have a fallback check for stdlibs that don't have a `.so` version (such as embedded)? Something as simple as: ```c++ std::string lib = GetFilePath("libc++.so", TC); if (lib.empty()) lib = GetFilePath("libc++.a", TC); ``` https://github.com/llvm/llvm