diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2018-07-10 00:50:25 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2018-07-10 00:50:25 +0000 |
commit | c6a6cc59273c246d9e578e7d6a9b56be87c232bc (patch) | |
tree | 074469786bc5805b61062ceee06abba920f04fd4 /test/CodeGen | |
parent | ba066d5d857128bff3ea63ff9cd504945c23ef26 (diff) |
Fix parsing of privacy annotations in os_log format strings.
Privacy annotations shouldn't have to appear in the first
comma-delimited string in order to be recognized. Also, they should be
ignored if they are preceded or followed by non-whitespace characters.
rdar://problem/40706280
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r-- | test/CodeGen/builtins.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/CodeGen/builtins.c b/test/CodeGen/builtins.c index 4f84db00cb..4059f16fbf 100644 --- a/test/CodeGen/builtins.c +++ b/test/CodeGen/builtins.c @@ -421,7 +421,29 @@ void test_builtin_os_log(void *buf, int i, const char *data) { // CHECK: %[[V5:.*]] = load i8*, i8** %[[DATA_ADDR]] // CHECK: %[[V6:.*]] = ptrtoint i8* %[[V5]] to i64 // CHECK: call void @__os_log_helper_1_3_4_4_0_8_34_4_17_8_49(i8* %[[V1]], i32 %[[V2]], i64 %[[V4]], i32 16, i64 %[[V6]]) - __builtin_os_log_format(buf, "%d %{public}s %{private}.16P", i, data, data); + __builtin_os_log_format(buf, "%d %{private,public}s %{public,private}.16P", i, data, data); + + // privacy annotations aren't recognized when they are preceded or followed + // by non-whitespace characters. + + // CHECK: call void @__os_log_helper_1_2_1_8_32( + __builtin_os_log_format(buf, "%{xyz public}s", data); + + // CHECK: call void @__os_log_helper_1_2_1_8_32( + __builtin_os_log_format(buf, "%{ public xyz}s", data); + + // CHECK: call void @__os_log_helper_1_2_1_8_32( + __builtin_os_log_format(buf, "%{ public1}s", data); + + // Privacy annotations do not have to be in the first comma-delimited string. + + // CHECK: call void @__os_log_helper_1_2_1_8_34( + __builtin_os_log_format(buf, "%{ xyz, public }s", "abc"); + + // The last privacy annotation in the string wins. + + // CHECK: call void @__os_log_helper_1_3_1_8_33( + __builtin_os_log_format(buf, "%{ public, private, public, private}s", "abc"); } // CHECK-LABEL: define linkonce_odr hidden void @__os_log_helper_1_3_4_4_0_8_34_4_17_8_49 |