Skip to content

Commit

Permalink
Downgrade invalid use of memberwise_ keywords errors into a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
cor3ntin committed Sep 12, 2024
1 parent b0624fd commit 7859fce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -2681,11 +2681,15 @@ def warn_final_dtor_non_final_class : Warning<
def note_final_dtor_non_final_class_silence : Note<
"mark %0 as '%select{final|sealed}1' to silence this warning">;

def err_trivially_relocatable_specifier_on_non_relocatable_class : Error<
"invalid 'trivially_relocatable' specifier on non trivially-relocatable class %0">;

def err_memberwise_replaceable_specifier_on_non_relocatable_class : Error<
"invalid 'memberwise_replaceable' specifier on non memberwise replaceable class %0">;
def warn_trivially_relocatable_specifier_on_non_relocatable_class : Warning<
"invalid 'trivially_relocatable' specifier on non trivially-relocatable class %0">,
InGroup<DiagGroup<"never-relocatatable">>,
DefaultError;

def warn_memberwise_replaceable_specifier_on_non_relocatable_class : Warning<
"invalid 'memberwise_replaceable' specifier on non memberwise replaceable class %0">,
InGroup<DiagGroup<"never-replaceable">>,
DefaultError;

def note_trivially_relocatable: Note<
"because it %select{inherits from a non trivially-relocatable class %1|"
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7280,7 +7280,7 @@ void Sema::CheckCXX2CTriviallyRelocatable(CXXRecordDecl *D) {
if (NotedError)
return;
Diag(Loc,
diag::err_trivially_relocatable_specifier_on_non_relocatable_class)
diag::warn_trivially_relocatable_specifier_on_non_relocatable_class)
<< D;
NotedError = true;
};
Expand Down Expand Up @@ -7378,7 +7378,7 @@ void Sema::CheckMemberwiseReplaceable(CXXRecordDecl *D) {
if (NotedError)
return false;
Diag(Loc,
diag::err_memberwise_replaceable_specifier_on_non_relocatable_class)
diag::warn_memberwise_replaceable_specifier_on_non_relocatable_class)
<< D;
bool Old = NotedError;
NotedError = true;
Expand Down

0 comments on commit 7859fce

Please sign in to comment.