[PATCH] D46805: If some platforms do not support an attribute, we should exclude the platform

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 26 11:28:37 PDT 2018


aaron.ballman added a comment.

@rsmith -- do the object file formats listed look correct to you?



================
Comment at: include/clang/Basic/Attr.td:322
+def TargetSupportsAlias : TargetSpec {
+  let ObjectFormats = ["COFF", "ELF", "Wasm"];
+}
----------------
Did you verify that Wasm supports the alias attribute? If it is supported, it might be nice to add a test to `CodeGen/alias.c` to demonstrate it. Similar for COFF.


================
Comment at: test/Sema/attr-alias-has.c:5
+// RUN: %clang_cc1 -triple wasm32-unknown-unknown -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple wasm64-unknown-unknown -fsyntax-only -verify %s
+
----------------
I'd like to see a test that the "attribute not supported on target" diagnostic is being generated. I'd recommend something along these lines:
```
void g() {}
void f() __attribute__((alias("g")));
#if !__has_attribute(alias)
// expected-error at -2{{expected diagnostic text}}
#else
// expected-no-diagnostics
#endif
```


Repository:
  rC Clang

https://reviews.llvm.org/D46805





More information about the cfe-commits mailing list