summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/PrintfFormatString.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2018-11-06 06:26:17 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2018-11-06 06:26:17 +0000
commitfb1e4465f14a4fcf8376a6c249bcdf86af915e69 (patch)
treef11106aece9ef810763f4f09fc9e5d5cc4eda363 /clang/lib/AST/PrintfFormatString.cpp
parentb17ebff627415bdbe37e5c8c1c3926edb1c349ed (diff)
downloadbcm5719-llvm-fb1e4465f14a4fcf8376a6c249bcdf86af915e69.tar.gz
bcm5719-llvm-fb1e4465f14a4fcf8376a6c249bcdf86af915e69.zip
os_log: Add a new privacy annotation "sensitive".
This is a stricter privacy annotation than "private", which will be used for data that shouldn’t be logged to disk. For backward compatibility, the "private" bit is set too. rdar://problem/36755912 llvm-svn: 346210
Diffstat (limited to 'clang/lib/AST/PrintfFormatString.cpp')
-rw-r--r--clang/lib/AST/PrintfFormatString.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index 71c28de99c9..a92375b4528 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -127,7 +127,8 @@ static PrintfSpecifierResult ParsePrintfSpecifier(FormatStringHandler &H,
do {
StringRef Str(I, E - I);
- std::string Match = "^[[:space:]]*(private|public)[[:space:]]*(,|})";
+ std::string Match = "^[[:space:]]*(private|public|sensitive)"
+ "[[:space:]]*(,|})";
llvm::Regex R(Match);
SmallVector<StringRef, 2> Matches;
@@ -138,7 +139,11 @@ static PrintfSpecifierResult ParsePrintfSpecifier(FormatStringHandler &H,
// Set the privacy flag if the privacy annotation in the
// comma-delimited segment is at least as strict as the privacy
// annotations in previous comma-delimited segments.
- if (MatchedStr.equals("private"))
+ if (MatchedStr.equals("sensitive"))
+ PrivacyFlags = clang::analyze_os_log::OSLogBufferItem::IsSensitive;
+ else if (PrivacyFlags !=
+ clang::analyze_os_log::OSLogBufferItem::IsSensitive &&
+ MatchedStr.equals("private"))
PrivacyFlags = clang::analyze_os_log::OSLogBufferItem::IsPrivate;
else if (PrivacyFlags == 0 && MatchedStr.equals("public"))
PrivacyFlags = clang::analyze_os_log::OSLogBufferItem::IsPublic;
@@ -168,6 +173,9 @@ static PrintfSpecifierResult ParsePrintfSpecifier(FormatStringHandler &H,
case clang::analyze_os_log::OSLogBufferItem::IsPublic:
FS.setIsPublic(MatchedStr.data());
break;
+ case clang::analyze_os_log::OSLogBufferItem::IsSensitive:
+ FS.setIsSensitive(MatchedStr.data());
+ break;
default:
llvm_unreachable("Unexpected privacy flag value");
}
OpenPOWER on IntegriCloud