================
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsyntax-only -fsanitize=kcfi -verify %s
+
+#define __cfi_salt(S) __attribute__((cfi_salt(S)))
+
+int foo(int a, int b) __cfi_salt("pepper"); // ok
+int foo(int a, int b) __cfi_salt("pepper"); // ok
+
+typedef int (*bar_t)(void) __cfi_salt("pepper"); // ok
+typedef int (*bar_t)(void) __cfi_salt("pepper"); // ok
+
+#if 0
+// FIXME: These should fail.
+int b(void) __cfi_salt("salt 'n") __cfi_salt("pepper");
+bar_t bar_fn __cfi_salt("salt 'n");
+#endif
+
----------------
AaronBallman wrote:

Oh, let me check something then...
```
void func(int a) __cfi_salt("pepper");
void func(int a) { } // Okay, inherits the attribute from the declaration.
```
isn't allowed with `__attribute__(())`` syntax as well? What about:
```
__cfi_salt("pepper") void func(int a);
void func(int a) {}
```
with either `__attribute__(())` or `[[]]` spellings?

What I'm trying to get at is the attribute is marked `DeclOrTypeAttr` but 
everything seems to suggest this is actually a `TypeAttr` and not a declaration 
attribute, so I'm trying to figure out whether the bug is with marking it 
`DeclOrTypeAttr` or whether we're missing implementation effort for it to work 
as a declaration attribute.

https://github.com/llvm/llvm-project/pull/141846
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to