[clang-tools-extra] [clang-tidy] Add modernize-use-to-underlying check (PR #210459)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 21 22:50:53 PDT 2026
================
@@ -0,0 +1,55 @@
+// RUN: %check_clang_tidy -check-suffixes=IGNORE -std=c++23-or-later %s \
+// RUN: modernize-use-to-underlying %t -- \
+// RUN: -config="{CheckOptions: {modernize-use-to-underlying.ImpreciseCasts: Ignore}}"
+// RUN: %check_clang_tidy -check-suffixes=WARN -std=c++23-or-later %s \
+// RUN: modernize-use-to-underlying %t -- \
+// RUN: -config="{CheckOptions: {modernize-use-to-underlying.ImpreciseCasts: Warn}}"
+// RUN: %check_clang_tidy -check-suffixes=PRESERVE -std=c++23-or-later %s \
+// RUN: modernize-use-to-underlying %t -- \
+// RUN: -config="{CheckOptions: {modernize-use-to-underlying.ImpreciseCasts: PreserveType}}"
----------------
zwuis wrote:
```suggestion
// RUN: %check_clang_tidy -check-suffixes=COMMON -std=c++23-or-later %s \
// RUN: modernize-use-to-underlying %t -- \
// RUN: -config="{CheckOptions: {modernize-use-to-underlying.ImpreciseCasts: Ignore}}"
// RUN: %check_clang_tidy -check-suffixes=COMMON -std=c++23-or-later %s \
// RUN: modernize-use-to-underlying %t -- \
// RUN: -config="{CheckOptions: {modernize-use-to-underlying.ImpreciseCasts: Warn}}"
// RUN: %check_clang_tidy -check-suffixes=COMMON,PRESERVE -std=c++23-or-later %s \
// RUN: modernize-use-to-underlying %t -- \
// RUN: -config="{CheckOptions: {modernize-use-to-underlying.ImpreciseCasts: PreserveType}}"
```
To simplify `// CHECK`s.
https://github.com/llvm/llvm-project/pull/210459
More information about the cfe-commits
mailing list