From 9c7ace60aa629ecb7bc836802a7f4e33ee1045f1 Mon Sep 17 00:00:00 2001 From: Ben Shi Date: Tue, 26 Oct 2021 08:39:51 +0000 Subject: [PATCH] [CUDA][NFC] Fix inexact warning message about lambdas Reviewed By: tra Differential Revision: https://reviews.llvm.org/D112521 --- .../clang/Basic/DiagnosticParseKinds.td | 2 +- clang/test/Parser/lambda-attr.cu | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index 297e974c6488..1bc2e8b0c7ef 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -1495,7 +1495,7 @@ def warn_pragma_unroll_cuda_value_in_parens : Warning< InGroup; def warn_cuda_attr_lambda_position : Warning< - "nvcc does not allow '__%0__' to appear after '()' in lambdas">, + "nvcc does not allow '__%0__' to appear after the parameter list in lambdas">, InGroup; def warn_pragma_force_cuda_host_device_bad_arg : Warning< "incorrect use of #pragma clang force_cuda_host_device begin|end">, diff --git a/clang/test/Parser/lambda-attr.cu b/clang/test/Parser/lambda-attr.cu index d5aaf0194605..886212b97f50 100644 --- a/clang/test/Parser/lambda-attr.cu +++ b/clang/test/Parser/lambda-attr.cu @@ -6,36 +6,36 @@ __attribute__((host, device)) void hd_fn() {} __attribute__((device)) void device_attr() { ([]() __attribute__((device)) { device_fn(); })(); - // expected-warning@-1 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + // expected-warning@-1 {{nvcc does not allow '__device__' to appear after the parameter list in lambdas}} ([] __attribute__((device)) () { device_fn(); })(); ([] __attribute__((device)) { device_fn(); })(); ([&]() __attribute__((device)){ device_fn(); })(); - // expected-warning@-1 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + // expected-warning@-1 {{nvcc does not allow '__device__' to appear after the parameter list in lambdas}} ([&] __attribute__((device)) () { device_fn(); })(); ([&] __attribute__((device)) { device_fn(); })(); ([&](int) __attribute__((device)){ device_fn(); })(0); - // expected-warning@-1 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + // expected-warning@-1 {{nvcc does not allow '__device__' to appear after the parameter list in lambdas}} ([&] __attribute__((device)) (int) { device_fn(); })(0); } __attribute__((host)) __attribute__((device)) void host_device_attrs() { ([]() __attribute__((host)) __attribute__((device)){ hd_fn(); })(); - // expected-warning@-1 {{nvcc does not allow '__host__' to appear after '()' in lambdas}} - // expected-warning@-2 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + // expected-warning@-1 {{nvcc does not allow '__host__' to appear after the parameter list in lambdas}} + // expected-warning@-2 {{nvcc does not allow '__device__' to appear after the parameter list in lambdas}} ([] __attribute__((host)) __attribute__((device)) () { hd_fn(); })(); ([] __attribute__((host)) __attribute__((device)) { hd_fn(); })(); ([&]() __attribute__((host)) __attribute__((device)){ hd_fn(); })(); - // expected-warning@-1 {{nvcc does not allow '__host__' to appear after '()' in lambdas}} - // expected-warning@-2 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + // expected-warning@-1 {{nvcc does not allow '__host__' to appear after the parameter list in lambdas}} + // expected-warning@-2 {{nvcc does not allow '__device__' to appear after the parameter list in lambdas}} ([&] __attribute__((host)) __attribute__((device)) () { hd_fn(); })(); ([&] __attribute__((host)) __attribute__((device)) { hd_fn(); })(); ([&](int) __attribute__((host)) __attribute__((device)){ hd_fn(); })(0); - // expected-warning@-1 {{nvcc does not allow '__host__' to appear after '()' in lambdas}} - // expected-warning@-2 {{nvcc does not allow '__device__' to appear after '()' in lambdas}} + // expected-warning@-1 {{nvcc does not allow '__host__' to appear after the parameter list in lambdas}} + // expected-warning@-2 {{nvcc does not allow '__device__' to appear after the parameter list in lambdas}} ([&] __attribute__((host)) __attribute__((device)) (int) { hd_fn(); })(0); }