summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/builtins.c
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2018-07-10 00:50:25 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2018-07-10 00:50:25 +0000
commit189359d1ff8a167271fcbe5c7a91c42c94dc253d (patch)
tree9fd0b4a0e37cd101d2910fbb76292a38493ba024 /clang/test/CodeGen/builtins.c
parent1faf953d7513154002a1b075cc308ec7fc301cff (diff)
downloadbcm5719-llvm-189359d1ff8a167271fcbe5c7a91c42c94dc253d.tar.gz
bcm5719-llvm-189359d1ff8a167271fcbe5c7a91c42c94dc253d.zip
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 llvm-svn: 336629
Diffstat (limited to 'clang/test/CodeGen/builtins.c')
-rw-r--r--clang/test/CodeGen/builtins.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/clang/test/CodeGen/builtins.c b/clang/test/CodeGen/builtins.c
index 4f84db00cbd..4059f16fbfd 100644
--- a/clang/test/CodeGen/builtins.c
+++ b/clang/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
OpenPOWER on IntegriCloud