llvm/llvm-project

Audit/Update `select` uses in DiagnosticXKinds.td to use `enum_select`.

Open

#123,121 建立於 2025年1月15日

在 GitHub 查看
 (9 留言) (0 反應) (1 負責人)C++ (10,782 fork)batch import
clang:diagnosticsgood first issuequality-of-implementation

倉庫指標

Star
 (26,378 star)
PR 合併指標
 (平均合併 1天 2小時) (30 天內合併 1,000 個 PR)

描述

enum_select was added in this patch here: https://github.com/llvm/llvm-project/pull/122505

It is a really useful version of select that also creates an enum so that we don't have to use unreliable 'magic numbers'. However, the original patch touches one such diagnostic.

We need someone to audit all of our uses of select and see if: 1- the select has a significant number of items in it. 2- A lot of the uses of the select for the diagnostic in the source use a lot of magic numbers, OR an enum-made-just-for it

So if the diagnostic tends to have a lot of /* ThingIWantSelected */ 5 sort of things (or worse, just the 5!), it is likely a good candidate. Ones that are 'calculated' based on some other criteria aren't a great.

One such example is from: https://github.com/llvm/llvm-project/pull/120327 , which is what encouraged this patch.

Once we have ones identified, someone should then go through and convert these diagnostics.

貢獻者指南