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
diff --git a/clang/lib/AST/PrintfFormatString.cpp b/clang/lib/AST/PrintfFormatString.cpp
index 71c28de..a92375b 100644
--- a/clang/lib/AST/PrintfFormatString.cpp
+++ b/clang/lib/AST/PrintfFormatString.cpp
@@ -127,7 +127,8 @@
 
     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 @@
         // 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 @@
     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");
     }