diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2018-11-06 07:05:14 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2018-11-06 07:05:14 +0000 |
commit | d572cf496ded73d93306420b320100f5aead62b0 (patch) | |
tree | 21cfb891ab247a9bff291a3520c01e3c8e33419a /clang/lib/CodeGen/CGBuiltin.cpp | |
parent | fb1e4465f14a4fcf8376a6c249bcdf86af915e69 (diff) | |
download | bcm5719-llvm-d572cf496ded73d93306420b320100f5aead62b0.tar.gz bcm5719-llvm-d572cf496ded73d93306420b320100f5aead62b0.zip |
os_log: Allow specifying mask type in format string.
A mask type is a 1 to 8-byte string that follows the "mask." annotation
in the format string. This enables obfuscating data in the event the
provided privacy level isn't enabled.
rdar://problem/36756282
llvm-svn: 346211
Diffstat (limited to 'clang/lib/CodeGen/CGBuiltin.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBuiltin.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index 76b46c7a5f6..4699a0c16ad 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -1168,7 +1168,12 @@ RValue CodeGenFunction::emitBuiltinOSLogFormat(const CallExpr &E) { llvm::Value *ArgVal; - if (const Expr *TheExpr = Item.getExpr()) { + if (Item.getKind() == analyze_os_log::OSLogBufferItem::MaskKind) { + uint64_t Val = 0; + for (unsigned I = 0, E = Item.getMaskType().size(); I < E; ++I) + Val |= ((unsigned )Item.getMaskType()[I]) << I * 8; + ArgVal = llvm::Constant::getIntegerValue(Int64Ty, llvm::APInt(64, Val)); + } else if (const Expr *TheExpr = Item.getExpr()) { ArgVal = EmitScalarExpr(TheExpr, /*Ignore*/ false); // Check if this is a retainable type. |