This revision was automatically updated to reflect the committed changes. Closed by commit rL258641: [CUDA] Reject the alias attribute in CUDA device code. (authored by jlebar).
Changed prior to commit: http://reviews.llvm.org/D16502?vs=45783&id=45809#toc Repository: rL LLVM http://reviews.llvm.org/D16502 Files: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaDeclAttr.cpp cfe/trunk/test/SemaCUDA/alias.cu Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td @@ -6425,6 +6425,7 @@ InGroup<CudaCompat>; def err_va_arg_in_device : Error< "CUDA device code does not support va_arg">; +def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">; def warn_non_pod_vararg_with_format_string : Warning< "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic " Index: cfe/trunk/test/SemaCUDA/alias.cu =================================================================== --- cfe/trunk/test/SemaCUDA/alias.cu +++ cfe/trunk/test/SemaCUDA/alias.cu @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -fcuda-is-device -verify -DEXPECT_ERR %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s + +// The alias attribute is not allowed in CUDA device code. +void bar(); +__attribute__((alias("bar"))) void foo(); +#ifdef EXPECT_ERR +// expected-error@-2 {{CUDA does not support aliases}} +#else +// expected-no-diagnostics +#endif Index: cfe/trunk/lib/Sema/SemaDeclAttr.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp @@ -1557,6 +1557,9 @@ S.Diag(Attr.getLoc(), diag::err_alias_not_supported_on_darwin); return; } + if (S.Context.getTargetInfo().getTriple().isNVPTX()) { + S.Diag(Attr.getLoc(), diag::err_alias_not_supported_on_nvptx); + } // Aliases should be on declarations, not definitions. if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td @@ -6425,6 +6425,7 @@ InGroup<CudaCompat>; def err_va_arg_in_device : Error< "CUDA device code does not support va_arg">; +def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">; def warn_non_pod_vararg_with_format_string : Warning< "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic " Index: cfe/trunk/test/SemaCUDA/alias.cu =================================================================== --- cfe/trunk/test/SemaCUDA/alias.cu +++ cfe/trunk/test/SemaCUDA/alias.cu @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -fcuda-is-device -verify -DEXPECT_ERR %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s + +// The alias attribute is not allowed in CUDA device code. +void bar(); +__attribute__((alias("bar"))) void foo(); +#ifdef EXPECT_ERR +// expected-error@-2 {{CUDA does not support aliases}} +#else +// expected-no-diagnostics +#endif Index: cfe/trunk/lib/Sema/SemaDeclAttr.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp @@ -1557,6 +1557,9 @@ S.Diag(Attr.getLoc(), diag::err_alias_not_supported_on_darwin); return; } + if (S.Context.getTargetInfo().getTriple().isNVPTX()) { + S.Diag(Attr.getLoc(), diag::err_alias_not_supported_on_nvptx); + } // Aliases should be on declarations, not definitions. if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits