benhamilton added a comment.
>@benhamilton We're planning to use the new attribute in
>https://reviews.llvm.org/D27165 to address this issue. I'll get back to that
>patch in the near future.
Great, thanks for the update.
Repository:
rL LLVM
https://reviews.llvm.org/D25820
arphaman added a comment.
@benhamilton We're planning to use the new attribute in
https://reviews.llvm.org/D27165 to address this issue. I'll get back to that
patch in the near future.
Repository:
rL LLVM
https://reviews.llvm.org/D25820
___
benhamilton added a comment.
I filed rdar://38143508 to track this.
The fix won't be easy; I think `__attribute__((format_arg(X)))` isn't enough to
capture how `-[NSBundle localizedStringForKey:value:table:]` works:
1. `__attribute__((format_arg(X)))` doesn't support multiple format arguments,
benhamilton added a comment.
> That does look like a bug in the SDK, to me.
OK. I'll file a Radar bug upstream; in the meantime, this means since this
diff landed in 2016, clang has been raising `-Wformat-extra-args` when
compiling any code which passes the result of `-[NSBundle
aaron.ballman added a comment.
In https://reviews.llvm.org/D25820#1027216, @benhamilton wrote:
> Actually, looking more deeply, it's possible this is a bug in the Apple SDK:
>
> @interface NSBundle
> - (NSString *)localizedStringForKey:(NSString *)key value:(nullable
> NSString *)value
benhamilton added a comment.
Actually, looking more deeply, it's possible this is a bug in the Apple SDK:
@interface NSBundle
- (NSString *)localizedStringForKey:(NSString *)key value:(nullable NSString
*)value table:(nullable NSString *)tableName __attribute__((format_arg(1)));
@end
benhamilton added a comment.
Herald added subscribers: llvm-commits, jkorous-apple.
This caused a regression where `__attribute__((format_arg(X))` no longer works
with ObjC message sends.
I filed https://bugs.llvm.org/show_bug.cgi?id=36599 and will write a fix.
Repository:
rL LLVM
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284961: [Sema] Formatting warnings should see through
Objective-C message sends (authored by arphaman).
Changed prior to commit:
https://reviews.llvm.org/D25820?vs=75408=75561#toc
Repository:
rL
aaron.ballman accepted this revision.
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM, thank you!
Repository:
rL LLVM
https://reviews.llvm.org/D25820
___
arphaman updated this revision to Diff 75408.
arphaman marked an inline comment as done.
arphaman added a comment.
The updated patch includes positive test cases.
Repository:
rL LLVM
https://reviews.llvm.org/D25820
Files:
lib/Sema/SemaChecking.cpp
test/SemaObjC/format-strings-objc.m
aaron.ballman added inline comments.
Comment at: test/SemaObjC/format-strings-objc.m:299
+ NSLog([self str: @"%@ %@"], @"name"); // expected-warning {{more '%'
conversions than data arguments}}
+}
+
Can you add an example showing a positive use case as well?
arphaman created this revision.
arphaman added a reviewer: manmanren.
arphaman added a subscriber: cfe-commits.
arphaman set the repository for this revision to rL LLVM.
This patch improves the '-Wformat' warnings by ensuring that the formatting
checker can see through Objective-C message sends
12 matches
Mail list logo