mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 04:29:42 +00:00
[Diagnostics] Make behaviour of Clang's -Wdeprecated-copy same as in GCC
Do not warn for functions that are explicitly marked delete or default, which follows the behavior of the GCC warning.
This commit is contained in:
parent
bc2b380c0d
commit
9e260c12bc
@ -12406,7 +12406,8 @@ static void diagnoseDeprecatedCopyOperation(Sema &S, CXXMethodDecl *CopyOp) {
|
||||
|
||||
// In Microsoft mode, assignment operations don't affect constructors and
|
||||
// vice versa.
|
||||
if (RD->hasUserDeclaredDestructor()) {
|
||||
if (RD->hasUserDeclaredDestructor() &&
|
||||
RD->getDestructor()->isUserProvided()) {
|
||||
UserDeclaredOperation = RD->getDestructor();
|
||||
} else if (!isa<CXXConstructorDecl>(CopyOp) &&
|
||||
RD->hasUserDeclaredCopyConstructor() &&
|
||||
@ -12432,7 +12433,7 @@ static void diagnoseDeprecatedCopyOperation(Sema &S, CXXMethodDecl *CopyOp) {
|
||||
assert(UserDeclaredOperation);
|
||||
}
|
||||
|
||||
if (UserDeclaredOperation) {
|
||||
if (UserDeclaredOperation && UserDeclaredOperation->isUserProvided()) {
|
||||
S.Diag(UserDeclaredOperation->getLocation(),
|
||||
isa<CXXDestructorDecl>(UserDeclaredOperation)
|
||||
? diag::warn_deprecated_copy_dtor_operation
|
||||
|
@ -101,6 +101,12 @@ namespace DeprecatedCopy {
|
||||
};
|
||||
Dtor c1, c2(c1); // expected-note {{implicit copy constructor for 'DeprecatedCopy::Dtor' first required here}}
|
||||
void g() { c1 = c2; } // expected-note {{implicit copy assignment operator for 'DeprecatedCopy::Dtor' first required here}}
|
||||
|
||||
struct DefaultedDtor {
|
||||
~DefaultedDtor() = default;
|
||||
};
|
||||
DefaultedDtor d1, d2(d1);
|
||||
void h() { d1 = d2; }
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user