<div dir="ltr">Ah, I think I found it. You indented it like this:<div><br></div><div><div> if (Method) {</div><div> if (ObjCMethodDecl *BestMethod =</div><div> SelectBestMethod(Sel, ArgsIn, Method->isInstanceMethod()))</div><div> Method = BestMethod;</div><div> SmallVector<ObjCMethodDecl*, 4> Methods;</div><div> if (!CollectMultipleMethodsInGlobalPool(Sel, Methods, Method->isInstanceMethod()))</div><div> DiagnoseUseOfDecl(Method, SelLoc);</div><div> }</div><div> }</div></div><div><br></div><div>but clang-format tells you that it should be indented like so:</div><div><br></div><div><div> if (Method) {</div><div> if (ObjCMethodDecl *BestMethod =</div><div> SelectBestMethod(Sel, ArgsIn, Method->isInstanceMethod()))</div><div> Method = BestMethod;</div><div> SmallVector<ObjCMethodDecl *, 4> Methods;</div><div> if (!CollectMultipleMethodsInGlobalPool(Sel, Methods,</div><div> Method->isInstanceMethod()))</div><div> DiagnoseUseOfDecl(Method, SelLoc);</div><div> }</div><div> }</div></div><div><br></div><div>That is, you added the {} to the outer if, but your indentation looks like you mentioned to add them to the inner if. (I should dust off and check in my -Windent warning.)</div><div><br>I'll try to come up with a test case, move the braces, and land that. Please let me know if this looks like the wrong fix to you.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 12, 2014 at 1:54 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This is causing <a href="http://llvm.org/bugs/show_bug.cgi?id=21587" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=21587</a><div><br></div><div>Looks like Sema::CollectMultipleMethodsInGlobalPool() should probably also look at stuff from an external sema source?</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 7, 2014 at 3:51 PM, Fariborz Jahanian <span dir="ltr"><<a href="mailto:fjahanian@apple.com" target="_blank">fjahanian@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: fjahanian<br>
Date: Fri Nov 7 17:51:15 2014<br>
New Revision: 221562<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=221562&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=221562&view=rev</a><br>
Log:<br>
[Objective-C Sema]. Issue availability/deprecated warning when<br>
there is a uinque method found when message is sent to receiver<br>
of 'id' type. // rdar://18848183<br>
<br>
Modified:<br>
cfe/trunk/lib/Sema/SemaExprObjC.cpp<br>
cfe/trunk/test/ARCMT/checking.m<br>
cfe/trunk/test/SemaObjC/attr-deprecated.m<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=221562&r1=221561&r2=221562&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=221562&r1=221561&r2=221562&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri Nov 7 17:51:15 2014<br>
@@ -2448,10 +2448,14 @@ ExprResult Sema::BuildInstanceMessage(Ex<br>
Method = LookupFactoryMethodInGlobalPool(Sel,<br>
SourceRange(LBracLoc,RBracLoc),<br>
receiverIsId);<br>
- if (Method)<br>
+ if (Method) {<br>
if (ObjCMethodDecl *BestMethod =<br>
SelectBestMethod(Sel, ArgsIn, Method->isInstanceMethod()))<br>
Method = BestMethod;<br>
+ SmallVector<ObjCMethodDecl*, 4> Methods;<br>
+ if (!CollectMultipleMethodsInGlobalPool(Sel, Methods, Method->isInstanceMethod()))<br>
+ DiagnoseUseOfDecl(Method, SelLoc);<br>
+ }<br>
} else if (ReceiverType->isObjCClassType() ||<br>
ReceiverType->isObjCQualifiedClassType()) {<br>
// Handle messages to Class.<br>
<br>
Modified: cfe/trunk/test/ARCMT/checking.m<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/checking.m?rev=221562&r1=221561&r2=221562&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/checking.m?rev=221562&r1=221561&r2=221562&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/ARCMT/checking.m (original)<br>
+++ cfe/trunk/test/ARCMT/checking.m Fri Nov 7 17:51:15 2014<br>
@@ -14,9 +14,9 @@ typedef int BOOL;<br>
typedef unsigned NSUInteger;<br>
<br>
@protocol NSObject<br>
-- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE;<br>
+- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note {{'retain' has been explicitly marked unavailable here}}<br>
- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE;<br>
-- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE;<br>
+- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note 4 {{'release' has been explicitly marked unavailable here}}<br>
- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE;<br>
@end<br>
<br>
@@ -74,16 +74,20 @@ id global_foo;<br>
<br>
void test1(A *a, BOOL b, struct UnsafeS *unsafeS) {<br>
[[a delegate] release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \<br>
+ // expected-error {{'release' is unavailable: not available in automatic reference counting mode}} \<br>
// expected-error {{ARC forbids explicit message send}}<br>
[a.delegate release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \<br>
+ // expected-error {{'release' is unavailable: not available in automatic reference counting mode}} \<br>
// expected-error {{ARC forbids explicit message send}}<br>
[unsafeS->unsafeObj retain]; // expected-error {{it is not safe to remove 'retain' message on an __unsafe_unretained type}} \<br>
// expected-error {{ARC forbids explicit message send}} \<br>
// expected-error {{'retain' is unavailable}}<br>
id foo = [unsafeS->unsafeObj retain]; // no warning.<br>
[global_foo retain]; // expected-error {{it is not safe to remove 'retain' message on a global variable}} \<br>
+ // expected-error {{'retain' is unavailable: not available in automatic reference counting mode}} \<br>
// expected-error {{ARC forbids explicit message send}}<br>
[global_foo release]; // expected-error {{it is not safe to remove 'release' message on a global variable}} \<br>
+ // expected-error {{'release' is unavailable: not available in automatic reference counting mode}} \<br>
// expected-error {{ARC forbids explicit message send}}<br>
[a dealloc];<br>
[a retain];<br>
@@ -304,7 +308,8 @@ void rdar9491791(int p) {<br>
<br>
// rdar://9504750<br>
void rdar9504750(id p) {<br>
- RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}}<br>
+ RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}} \<br>
+ // expected-error {{'release' is unavailable: not available in automatic reference counting mode}}<br>
}<br>
<br>
// rdar://8939557<br>
<br>
Modified: cfe/trunk/test/SemaObjC/attr-deprecated.m<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-deprecated.m?rev=221562&r1=221561&r2=221562&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-deprecated.m?rev=221562&r1=221561&r2=221562&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/SemaObjC/attr-deprecated.m (original)<br>
+++ cfe/trunk/test/SemaObjC/attr-deprecated.m Fri Nov 7 17:51:15 2014<br>
@@ -5,7 +5,7 @@<br>
int X __attribute__((deprecated)); // expected-note 2 {{'X' has been explicitly marked deprecated here}}<br>
}<br>
+ (void)F __attribute__((deprecated)); // expected-note 2 {{'F' has been explicitly marked deprecated here}}<br>
-- (void)f __attribute__((deprecated)); // expected-note 4 {{'f' has been explicitly marked deprecated here}}<br>
+- (void)f __attribute__((deprecated)); // expected-note 5 {{'f' has been explicitly marked deprecated here}}<br>
@end<br>
<br>
@implementation A<br>
@@ -54,7 +54,7 @@ void t1(A *a)<br>
<br>
void t2(id a)<br>
{<br>
- [a f];<br>
+ [a f]; // expected-warning {{'f' is deprecated}}<br>
}<br>
<br>
void t3(A<P>* a)<br>
@@ -228,3 +228,13 @@ expected-note {{property declared here}}<br>
<br>
@end<br>
<br>
+// rdar://18848183<br>
+@interface NSString<br>
+- (const char *)cString __attribute__((availability(macosx,introduced=10.0 ,deprecated=10.4,message="" ))); // expected-note {{'cString' has been explicitly marked deprecated here}}<br>
+@end<br>
+<br>
+id PID = 0;<br>
+const char * func() {<br>
+ return [PID cString]; // expected-warning {{'cString' is deprecated: first deprecated in OS X 10.4}}<br>
+}<br>
+<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>