diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2018-07-17 13:17:01 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2018-07-17 13:17:01 +0000 |
| commit | c41e096bdab0fd5a1e08b8cac55a589d71d3339c (patch) | |
| tree | a17dfe9a9f77bbd7441b74da5fbf8b360abf2885 | |
| parent | b79e61f8b30197d68bf76d36c1328d618232f882 (diff) | |
| download | bcm5719-llvm-c41e096bdab0fd5a1e08b8cac55a589d71d3339c.tar.gz bcm5719-llvm-c41e096bdab0fd5a1e08b8cac55a589d71d3339c.zip | |
Revert "[Sema] Reword warning for constant captures that are not required"
This reverts commit r337152. This applies to non-constants too. The real
explanation is that the capture is not ODR-used, but putting that into
the warning message seems ... worse.
llvm-svn: 337278
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 4 | ||||
| -rw-r--r-- | clang/test/SemaCXX/warn-unused-lambda-capture.cpp | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index c32b5ea07a9..1915f7e3bed 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -341,8 +341,8 @@ def warn_unneeded_member_function : Warning< InGroup<UnneededMemberFunction>, DefaultIgnore; def warn_unused_private_field: Warning<"private field %0 is not used">, InGroup<UnusedPrivateField>, DefaultIgnore; -def warn_unused_lambda_capture: Warning<"lambda capture " - "%select{|of constant }1%0 is not %select{used|required for this use}1">, +def warn_unused_lambda_capture: Warning<"lambda capture %0 is not " + "%select{used|required to be captured for this use}1">, InGroup<UnusedLambdaCapture>, DefaultIgnore; def warn_parameter_size: Warning< diff --git a/clang/test/SemaCXX/warn-unused-lambda-capture.cpp b/clang/test/SemaCXX/warn-unused-lambda-capture.cpp index f1f0c9e2bc1..52ec390b0bb 100644 --- a/clang/test/SemaCXX/warn-unused-lambda-capture.cpp +++ b/clang/test/SemaCXX/warn-unused-lambda-capture.cpp @@ -41,9 +41,9 @@ void test() { auto explicit_by_value_used = [i] { return i + 1; }; auto explicit_by_value_used_void = [i] { (void)i; }; auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 'i' is not used}} - auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // expected-warning{{lambda capture of constant 'i' is not required for this use}} - auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // expected-warning{{lambda capture of constant 'i' is not required for this use}} - auto explicit_by_value_unused_const = [k] { return k + 1; }; // expected-warning{{lambda capture of constant 'k' is not required for this use}} + auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // expected-warning{{lambda capture 'i' is not required to be captured for this use}} + auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // expected-warning{{lambda capture 'i' is not required to be captured for this use}} + auto explicit_by_value_unused_const = [k] { return k + 1; }; // expected-warning{{lambda capture 'k' is not required to be captured for this use}} auto explicit_by_reference_used = [&i] { i++; }; auto explicit_by_reference_unused = [&i] {}; // expected-warning{{lambda capture 'i' is not used}} @@ -146,10 +146,10 @@ void test_templated() { auto explicit_by_value_used_void = [i] { (void)i; }; auto explicit_by_value_unused = [i] {}; // expected-warning{{lambda capture 'i' is not used}} - auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // expected-warning{{lambda capture of constant 'i' is not required for this use}} + auto explicit_by_value_unused_sizeof = [i] { return sizeof(i); }; // expected-warning{{lambda capture 'i' is not required to be captured for this use}} auto explicit_by_value_unused_decltype = [i] { decltype(i) j = 0; }; // expected-warning{{lambda capture 'i' is not used}} - auto explicit_by_value_unused_const = [k] { return k + 1; }; // expected-warning{{lambda capture of constant 'k' is not required for this use}} - auto explicit_by_value_unused_const_generic = [k](auto c) { return k + 1; }; // expected-warning{{lambda capture of constant 'k' is not required for this use}} + auto explicit_by_value_unused_const = [k] { return k + 1; }; // expected-warning{{lambda capture 'k' is not required to be captured for this use}} + auto explicit_by_value_unused_const_generic = [k](auto c) { return k + 1; }; // expected-warning{{lambda capture 'k' is not required to be captured for this use}} auto explicit_by_reference_used = [&i] { i++; }; auto explicit_by_reference_unused = [&i] {}; // expected-warning{{lambda capture 'i' is not used}} |

