| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
void test_builtin_allow_sanitize_check() { |
| 4 |
// Test with non-string literal argument. |
| 5 |
char str[] = "address"; |
| 6 |
(void)__builtin_allow_sanitize_check(str); // expected-error {{expression is not a string literal}} |
| 7 |
(void)__builtin_allow_sanitize_check(123); // expected-error {{expression is not a string literal}} |
| 8 |
|
| 9 |
// Test with unsupported sanitizer name. |
| 10 |
(void)__builtin_allow_sanitize_check("unsupported"); // expected-error {{invalid argument 'unsupported' to __builtin_allow_sanitize_check}} |
| 11 |
|
| 12 |
// Test with supported sanitizer names. |
| 13 |
(void)__builtin_allow_sanitize_check("address"); |
| 14 |
(void)__builtin_allow_sanitize_check("thread"); |
| 15 |
(void)__builtin_allow_sanitize_check("memory"); |
| 16 |
(void)__builtin_allow_sanitize_check("hwaddress"); |
| 17 |
(void)__builtin_allow_sanitize_check("kernel-address"); |
| 18 |
(void)__builtin_allow_sanitize_check("kernel-memory"); |
| 19 |
(void)__builtin_allow_sanitize_check("kernel-hwaddress"); |
| 20 |
} |
| 21 |
|
| 22 |
#if !__has_builtin(__builtin_allow_sanitize_check) |
| 23 |
#error "missing __builtin_allow_sanitize_check" |
| 24 |
#endif |