[PATCH] D107125: [Diagnostic] Split 'qualifier on reference type has no effect' out into a new flag
Luna Kirkby via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 29 18:12:34 PDT 2021
lunasorcery created this revision.
lunasorcery added a reviewer: rsmith.
lunasorcery added a project: clang.
lunasorcery requested review of this revision.
Herald added a subscriber: cfe-commits.
This introduces a new flag `ignored-reference-qualifiers` for the existing "'A' qualifier on reference type B has no effect" diagnostic, as a child of `ignored-qualifiers`.
Rationale:
This particular diagnostic is enabled by default, but other parts of `ignored-qualifiers` are not. Anecdotally, a user may encounter this diagnostic in the wild, and, seeing it to be valuable, might try to raise it to error with `-Werror=ignored-qualifiers`, whereupon the //other// diagnostics the flag covers will also be raised, to the user's surprise and confusion. By splitting this diagnostic out into a separate flag, and marking it as a child of `ignored-qualifiers`, we maintain backwards compatibility with existing build scripts, while allowing the user more granular control of the diagnostics they care about.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D107125
Files:
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
Index: clang/include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5733,7 +5733,7 @@
"'%0' qualifier on function type %1 has unspecified behavior">;
def warn_typecheck_reference_qualifiers : Warning<
"'%0' qualifier on reference type %1 has no effect">,
- InGroup<IgnoredQualifiers>;
+ InGroup<IgnoredReferenceQualifiers>;
def err_typecheck_invalid_restrict_not_pointer : Error<
"restrict requires a pointer or reference (%0 is invalid)">;
def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
Index: clang/include/clang/Basic/DiagnosticGroups.td
===================================================================
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -400,7 +400,8 @@
def InfiniteRecursion : DiagGroup<"infinite-recursion">;
def PureVirtualCallFromCtorDtor: DiagGroup<"call-to-pure-virtual-from-ctor-dtor">;
def GNUImaginaryConstant : DiagGroup<"gnu-imaginary-constant">;
-def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">;
+def IgnoredReferenceQualifiers : DiagGroup<"ignored-reference-qualifiers">;
+def IgnoredQualifiers : DiagGroup<"ignored-qualifiers", [IgnoredReferenceQualifiers]>;
def : DiagGroup<"import">;
def GNUIncludeNext : DiagGroup<"gnu-include-next">;
def IncompatibleMSStruct : DiagGroup<"incompatible-ms-struct">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107125.362934.patch
Type: text/x-patch
Size: 1500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210730/efca5e85/attachment.bin>
More information about the cfe-commits
mailing list