Inhibit ObjC format warning only in system headers (NSLocalizedString).
Add a test case for the related NSAssert workaround.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156205 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/format-strings-objc.m b/test/SemaObjC/format-strings-objc.m
index 987889b..c1285b2 100644
--- a/test/SemaObjC/format-strings-objc.m
+++ b/test/SemaObjC/format-strings-objc.m
@@ -111,11 +111,20 @@
 }
 
 // Do not emit warnings when using NSLocalizedString
-extern NSString *GetLocalizedString(NSString *str);
-#define NSLocalizedString(key) GetLocalizedString(key)
+#include "format-strings-system.h"
+
+// Test it inhibits diag only for macros in system headers
+#define MyNSLocalizedString(key) GetLocalizedString(key)
+#define MyNSAssert(fmt, arg) NSLog(fmt, arg, 0, 0)
 
 void check_NSLocalizedString() {
   [Foo fooWithFormat:NSLocalizedString(@"format"), @"arg"]; // no-warning
+  [Foo fooWithFormat:MyNSLocalizedString(@"format"), @"arg"]; // expected-warning {{format string is not a string literal}}}
+}
+
+void check_NSAssert() {
+  NSAssert(@"Hello %@", @"World"); // no-warning
+  MyNSAssert(@"Hello %@", @"World"); // expected-warning  {{data argument not used by format string}}
 }
 
 typedef __WCHAR_TYPE__ wchar_t;