From 7859fceba5dbf0ab3902ff4c26b7ec9407c5953c Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Thu, 12 Sep 2024 12:26:32 +0200 Subject: [PATCH] Downgrade invalid use of memberwise_ keywords errors into a warning --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 14 +++++++++----- clang/lib/Sema/SemaDeclCXX.cpp | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index baba389dbcf0a0..29eeb40d5f9de5 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -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>, + DefaultError; + +def warn_memberwise_replaceable_specifier_on_non_relocatable_class : Warning< + "invalid 'memberwise_replaceable' specifier on non memberwise replaceable class %0">, + InGroup>, + DefaultError; def note_trivially_relocatable: Note< "because it %select{inherits from a non trivially-relocatable class %1|" diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index b75e9317ea5393..b933e1a8e5c7ff 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -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; }; @@ -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;