[PATCH] D110668: [clang-cl] Accept `#pragma warning(disable : N)` for some N

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 29 05:55:15 PDT 2021


thakis added inline comments.


================
Comment at: clang/lib/Basic/CLWarnings.cpp:17
+  switch (CLWarningID) {
+  case 4005: return "macro-redefined";
+  case 4018: return "sign-compare";
----------------
hans wrote:
> Would it be possible to reference the DiagGroup symbolically here somehow instead of using a string? That way, if the DiagGroup gets renamed, we don't risk forgetting to update this string.
As far as I can tell, diagnostic groups don't exist as enums. Options:

- Make this function return a diag:: that the number maps to, and then use `DiagnosticIDs::getWarningOptionForDiag()` to get that diag's group name and disable that. That should work, but it's a bit confusing since we'd return a single diag here (either of warn_deprecated, warn_property_method_deprecated, warn_atl_uuid_deprecated and several others would have the same effect of representing the group DeprecatedDeclarations) but then disable the whole group.

- Update clang-tblgen to emit something that can be used to create a DiagGroup enum and use that.

The latter sounds better to me, so I'll look into that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110668/new/

https://reviews.llvm.org/D110668



More information about the cfe-commits mailing list