[PATCH] [PATCH] Disabling warnings on unused parameters if function is deleted/ defaulted (cxx11) [PR19303]
Reid Kleckner
rnk at google.com
Fri Apr 25 14:02:28 PDT 2014
================
Comment at: lib/Sema/SemaDecl.cpp:9935-9936
@@ -9934,4 +9934,4 @@
if (!FD->isInvalidDecl()) {
- DiagnoseUnusedParameters(FD->param_begin(), FD->param_end());
- DiagnoseSizeOfParametersAndReturnValue(FD->param_begin(), FD->param_end(),
- FD->getReturnType(), FD);
+ // In case of cxx11, Body is null if function is marked deleted/ defaulted
+ // out-of-line. Calling these DiagnoseXXX in such cases is not useful.
+ if (Body) {
----------------
This comment should be higher level, explaining why it's doing this, not how it's doing it. The code itself is fairly obvious. For example:
// Don't diagnose unused parameters of defaulted or deleted functions.
================
Comment at: lib/Sema/SemaDecl.cpp:9939-9940
@@ +9938,4 @@
+ DiagnoseUnusedParameters(FD->param_begin(), FD->param_end());
+ DiagnoseSizeOfParametersAndReturnValue(
+ FD->param_begin(), FD->param_end(), FD->getReturnType(), FD);
+ }
----------------
This might apply to a copy constructor for a large class. Consider:
struct A {
int a[LARGE];
A(A a);
};
A::A(A a) = default; // expected-warning {{...}}
http://reviews.llvm.org/D3376
More information about the cfe-commits
mailing list