-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[NFC] Deduplicate clang::AccessKinds to diagnostic strings #102030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cor3ntin
merged 1 commit into
llvm:main
from
MitalAshok:nfc-cleanup-accesskinds-diagnostics
Aug 12, 2024
Merged
[NFC] Deduplicate clang::AccessKinds to diagnostic strings #102030
cor3ntin
merged 1 commit into
llvm:main
from
MitalAshok:nfc-cleanup-accesskinds-diagnostics
Aug 12, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-clang Author: Mital Ashok (MitalAshok) ChangesFull diff: https://github.com/llvm/llvm-project/pull/102030.diff 1 Files Affected:
diff --git a/clang/include/clang/Basic/DiagnosticASTKinds.td b/clang/include/clang/Basic/DiagnosticASTKinds.td
index a024f9b2a9f8c..eb82e0159b56e 100644
--- a/clang/include/clang/Basic/DiagnosticASTKinds.td
+++ b/clang/include/clang/Basic/DiagnosticASTKinds.td
@@ -166,15 +166,22 @@ def note_constexpr_heap_alloc_limit_exceeded : Note<
def note_constexpr_this : Note<
"%select{|implicit }0use of 'this' pointer is only allowed within the "
"evaluation of a call to a 'constexpr' member function">;
-def note_constexpr_lifetime_ended : Note<
+def access_kind : TextSubstitution<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|construction of|"
- "destruction of}0 %select{temporary|variable}1 whose "
- "%plural{8:storage duration|:lifetime}0 has ended">;
-def note_constexpr_access_uninit : Note<
+ "destruction of}0">;
+def access_kind_subobject : TextSubstitution<
"%select{read of|read of|assignment to|increment of|decrement of|"
"member call on|dynamic_cast of|typeid applied to|"
- "construction of subobject of|destruction of}0 "
+ "construction of subobject of|destruction of}0">;
+def access_kind_volatile : TextSubstitution<
+ "%select{read of|read of|assignment to|increment of|decrement of|"
+ "<ERROR>|<ERROR>|<ERROR>|<ERROR>|<ERROR>}0">;
+def note_constexpr_lifetime_ended : Note<
+ "%sub{access_kind}0 %select{temporary|variable}1 whose "
+ "%plural{8:storage duration|:lifetime}0 has ended">;
+def note_constexpr_access_uninit : Note<
+ "%sub{access_kind_subobject}0 "
"%select{object outside its lifetime|uninitialized object}1 "
"is not allowed in a constant expression">;
def note_constexpr_use_uninit_reference : Note<
@@ -184,20 +191,16 @@ def note_constexpr_modify_const_type : Note<
"modification of object of const-qualified type %0 is not allowed "
"in a constant expression">;
def note_constexpr_access_volatile_type : Note<
- "%select{read of|read of|assignment to|increment of|decrement of|"
- "<ERROR>|<ERROR>|<ERROR>|<ERROR>}0 "
+ "%sub{access_kind_volatile}0 "
"volatile-qualified type %1 is not allowed in a constant expression">;
def note_constexpr_access_volatile_obj : Note<
- "%select{read of|read of|assignment to|increment of|decrement of|"
- "<ERROR>|<ERROR>|<ERROR>|<ERROR>}0 "
+ "%sub{access_kind_volatile}0 "
"volatile %select{temporary|object %2|member %2}1 is not allowed in "
"a constant expression">;
def note_constexpr_volatile_here : Note<
"volatile %select{temporary created|object declared|member declared}0 here">;
def note_constexpr_access_mutable : Note<
- "%select{read of|read of|assignment to|increment of|decrement of|"
- "member call on|dynamic_cast of|typeid applied to|construction of|"
- "destruction of}0 "
+ "%sub{access_kind}0 "
"mutable member %1 is not allowed in a constant expression">;
def note_constexpr_ltor_non_const_int : Note<
"read of non-const variable %0 is not allowed in a constant expression">;
@@ -209,47 +212,28 @@ def note_constexpr_ltor_non_constexpr : Note<
def note_constexpr_ltor_incomplete_type : Note<
"read of incomplete type %0 is not allowed in a constant expression">;
def note_constexpr_access_null : Note<
- "%select{read of|read of|assignment to|increment of|decrement of|"
- "member call on|dynamic_cast of|typeid applied to|construction of|"
- "destruction of}0 "
+ "%sub{access_kind}0 "
"dereferenced null pointer is not allowed in a constant expression">;
def note_constexpr_access_past_end : Note<
- "%select{read of|read of|assignment to|increment of|decrement of|"
- "member call on|dynamic_cast of|typeid applied to|construction of|"
- "destruction of}0 "
- "dereferenced one-past-the-end pointer is not allowed "
- "in a constant expression">;
+ "%sub{access_kind}0 dereferenced one-past-the-end pointer "
+ "is not allowed in a constant expression">;
def note_constexpr_access_unsized_array : Note<
- "%select{read of|read of|assignment to|increment of|decrement of|"
- "member call on|dynamic_cast of|typeid applied to|construction of|"
- "destruction of}0 "
- "element of array without known bound "
+ "%sub{access_kind}0 element of array without known bound "
"is not allowed in a constant expression">;
def note_constexpr_access_inactive_union_member : Note<
- "%select{read of|read of|assignment to|increment of|decrement of|"
- "member call on|dynamic_cast of|typeid applied to|"
- "construction of subobject of|destruction of}0 "
+ "%sub{access_kind_subobject}0 "
"member %1 of union with %select{active member %3|no active member}2 "
"is not allowed in a constant expression">;
def note_constexpr_union_member_change_during_init : Note<
"assignment would change active union member during the initialization of "
"a different member of the same union">;
def note_constexpr_access_static_temporary : Note<
- "%select{read of|read of|assignment to|increment of|decrement of|"
- "member call on|dynamic_cast of|typeid applied to|reconstruction of|"
- "destruction of}0 temporary "
- "is not allowed in a constant expression outside the expression that "
- "created the temporary">;
+ "%sub{access_kind}0 temporary is not allowed in a constant expression "
+ "outside the expression that created the temporary">;
def note_constexpr_access_unreadable_object : Note<
- "%select{read of|read of|assignment to|increment of|decrement of|"
- "member call on|dynamic_cast of|typeid applied to|construction of|"
- "destruction of}0 "
- "object '%1' whose value is not known">;
+ "%sub{access_kind}0 object '%1' whose value is not known">;
def note_constexpr_access_deleted_object : Note<
- "%select{read of|read of|assignment to|increment of|decrement of|"
- "member call on|dynamic_cast of|typeid applied to|construction of|"
- "destruction of}0 "
- "heap allocated object that has been deleted">;
+ "%sub{access_kind}0 heap allocated object that has been deleted">;
def note_constexpr_modify_global : Note<
"a constant expression cannot modify an object that is visible outside "
"that expression">;
|
cor3ntin
approved these changes
Aug 5, 2024
@cor3ntin Could you please merge this for me? Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
clang
Clang issues not falling into any other category
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.