[clang] [clang][tools] Handle weak (and duplicate) symbols in clang-extdef-mapping (PR #222010)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 06:33:05 PDT 2026


NagyDonat wrote:

> The "Misc/warning-flags.c" tells that all new warnings should have a `-W` option. Is this option needed for **clang-extdef-mapping** [... ? ]

As this warning is (if I understand correctly) only emitted by `clang-extdef-mapping`, the corresponding `-W` command line option should not appear when the clang compiler prints the "normal" `-W` options.

If the `-W` option corresponding to this warning doesn't pollute the list of "normal" options, then its existence does not matter. Feel free to introduce it if that's the easier to implement, but if it doesn't exist that is also fine.

> [...] or the warning should be printed in other way (not using the diagnostic API?) ?

There is a way to introduce "custom" warnings (and other custom diagnostics) that are not listed in a static `.td` file (and I presume don't need to have a `-W` option), but can be still emitted the same way as the "regular" diagnostics.

In particular, all reports emitted by Clang Tidy use this custom diagnostic API with calls like `DiagEngine->getDiagnosticIDs()->getCustomDiagID( [...] )`. For details see `ClangTidyDiagnosticConsumer.cpp`, I think you can easily adapt those solutions to work around this test failure.

(Disclaimer: I'm only vaguely familiar with these APIs, so I'm not 100% confident in my suggestions.)

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


More information about the cfe-commits mailing list