summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-02-07 19:25:10 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-02-07 19:25:10 +0000
commit7395c79c4e1432c88fc3558427331cb33f84c40e (patch)
treefd726d5836cbdd3e1de982c2220cf07ac6e489c0 /clang
parent4c484ecb31590a618741218a7aaeb348d648e960 (diff)
downloadbcm5719-llvm-7395c79c4e1432c88fc3558427331cb33f84c40e.tar.gz
bcm5719-llvm-7395c79c4e1432c88fc3558427331cb33f84c40e.zip
Objective-C. Revert patch r193003 for further
internal discussions. // rdar://16006401 llvm-svn: 200986
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp21
-rw-r--r--clang/test/SemaObjC/format-arg-attribute.m28
2 files changed, 4 insertions, 45 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 053ab2d620c..07f25c15faa 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -2188,27 +2188,6 @@ checkFormatStringExpr(Sema &S, const Expr *E, ArrayRef<const Expr *> Args,
return SLCT_NotALiteral;
}
-
- case Stmt::ObjCMessageExprClass: {
- const ObjCMessageExpr *ME = cast<ObjCMessageExpr>(E);
- if (const ObjCMethodDecl *MDecl = ME->getMethodDecl()) {
- if (const NamedDecl *ND = dyn_cast<NamedDecl>(MDecl)) {
- if (const FormatArgAttr *FA = ND->getAttr<FormatArgAttr>()) {
- unsigned ArgIndex = FA->getFormatIdx();
- if (ArgIndex <= ME->getNumArgs()) {
- const Expr *Arg = ME->getArg(ArgIndex-1);
- return checkFormatStringExpr(S, Arg, Args,
- HasVAListArg, format_idx,
- firstDataArg, Type, CallType,
- InFunctionCall, CheckedVarArgs);
- }
- }
- }
- }
-
- return SLCT_NotALiteral;
- }
-
case Stmt::ObjCStringLiteralClass:
case Stmt::StringLiteralClass: {
const StringLiteral *StrE = NULL;
diff --git a/clang/test/SemaObjC/format-arg-attribute.m b/clang/test/SemaObjC/format-arg-attribute.m
index e770373a055..79f5656decc 100644
--- a/clang/test/SemaObjC/format-arg-attribute.m
+++ b/clang/test/SemaObjC/format-arg-attribute.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -Werror -Wformat-nonliteral -verify -fsyntax-only %s
+// RUN: %clang_cc1 -verify -fsyntax-only %s
@class NSString;
@@ -9,9 +9,9 @@ extern void fc1 (const NSString *) __attribute__((format_arg)); // expected-err
extern void fc2 (const NSString *) __attribute__((format_arg())); // expected-error {{'format_arg' attribute takes one argument}}
extern void fc3 (const NSString *) __attribute__((format_arg(1, 2))); // expected-error {{'format_arg' attribute takes one argument}}
-struct s1 { int i; } __attribute__((format_arg(1))); // expected-error {{'format_arg' attribute only applies to functions}}
-union u1 { int i; } __attribute__((format_arg(1))); // expected-error {{'format_arg' attribute only applies to functions}}
-enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-error {{'format_arg' attribute only applies to functions}}
+struct s1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
+union u1 { int i; } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
+enum e1 { E1V0 } __attribute__((format_arg(1))); // expected-warning {{'format_arg' attribute only applies to functions}}
extern NSString *ff3 (const NSString *) __attribute__((format_arg(3-2)));
extern NSString *ff4 (const NSString *) __attribute__((format_arg(foo))); // expected-error {{use of undeclared identifier 'foo'}}
@@ -25,23 +25,3 @@ extern NSString *fi2 (NSString *) __attribute__((format_arg(1)));
extern int fi3 (const NSString *) __attribute__((format_arg(1))); // expected-error {{function does not return NSString}}
extern NSString *fi4 (const NSString *) __attribute__((format_arg(1)));
extern NSString *fi5 (const NSString *) __attribute__((format_arg(1)));
-
-// rdar://15242010
-@interface NSString
-+ (id)stringWithFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2)));
-@end
-
-@interface NSBundle
-- (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName __attribute__ ((format_arg(1)));
-+ (NSBundle *)mainBundle;
-@end
-
-
-NSString* localizedFormat(NSString* string) __attribute__ ((format_arg(1)));
-
-int main()
-{
- [NSString stringWithFormat:[[NSBundle mainBundle] localizedStringForKey:@"foo %d" value:@"bar %d" table:0], 42];
-
- [NSString stringWithFormat:localizedFormat(@"foo %d"), 42];
-}
OpenPOWER on IntegriCloud