<div dir="ltr">OK.<div><br></div><div>-eric</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jan 22, 2016 at 5:56 PM Justin Lebar <<a href="mailto:jlebar@google.com">jlebar@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">jlebar created this revision.<br>
jlebar added a reviewer: tra.<br>
jlebar added subscribers: echristo, jhen, cfe-commits.<br>
<br>
CUDA (well, strictly speaking, NVPTX) doesn't support aliases.<br>
<br>
<a href="http://reviews.llvm.org/D16502" rel="noreferrer" target="_blank">http://reviews.llvm.org/D16502</a><br>
<br>
Files:<br>
  include/clang/Basic/DiagnosticSemaKinds.td<br>
  lib/Sema/SemaDeclAttr.cpp<br>
  test/SemaCUDA/<a href="http://alias.cu" rel="noreferrer" target="_blank">alias.cu</a><br>
<br>
Index: test/SemaCUDA/<a href="http://alias.cu" rel="noreferrer" target="_blank">alias.cu</a><br>
===================================================================<br>
--- /dev/null<br>
+++ test/SemaCUDA/<a href="http://alias.cu" rel="noreferrer" target="_blank">alias.cu</a><br>
@@ -0,0 +1,14 @@<br>
+// REQUIRES: x86-registered-target<br>
+// REQUIRES: nvptx-registered-target<br>
+// RUN: %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -fcuda-is-device -verify -DEXPECT_ERR %s<br>
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s<br>
+<br>
+<br>
+// The alias attribute is not allowed in CUDA device code.<br>
+void bar();<br>
+__attribute__((alias("bar"))) void foo();<br>
+#ifdef EXPECT_ERR<br>
+// expected-error@-2 {{CUDA does not support aliases}}<br>
+#else<br>
+// expected-no-diagnostics<br>
+#endif<br>
Index: lib/Sema/SemaDeclAttr.cpp<br>
===================================================================<br>
--- lib/Sema/SemaDeclAttr.cpp<br>
+++ lib/Sema/SemaDeclAttr.cpp<br>
@@ -1557,6 +1557,9 @@<br>
     S.Diag(Attr.getLoc(), diag::err_alias_not_supported_on_darwin);<br>
     return;<br>
   }<br>
+  if (S.Context.getTargetInfo().getTriple().isNVPTX()) {<br>
+    S.Diag(Attr.getLoc(), diag::err_alias_not_supported_on_nvptx);<br>
+  }<br>
<br>
   // Aliases should be on declarations, not definitions.<br>
   if (const auto *FD = dyn_cast<FunctionDecl>(D)) {<br>
Index: include/clang/Basic/DiagnosticSemaKinds.td<br>
===================================================================<br>
--- include/clang/Basic/DiagnosticSemaKinds.td<br>
+++ include/clang/Basic/DiagnosticSemaKinds.td<br>
@@ -6427,6 +6427,7 @@<br>
   "CUDA device code does not support variadic functions">;<br>
 def err_va_arg_in_device : Error<<br>
   "CUDA device code does not support va_arg">;<br>
+def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;<br>
<br>
 def warn_non_pod_vararg_with_format_string : Warning<<br>
   "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "<br>
<br>
<br>
</blockquote></div>