<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 17, 2013 at 4:49 PM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@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: adrian<br>
Date: Fri May 17 18:49:10 2013<br>
New Revision: 182176<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=182176&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=182176&view=rev</a><br>
Log:<br>
ObjC Debug Info: Emit the correct method names for accessors for<br>
properties declared in a protocol.<br>
<br>
rdar://problem/13798000<br>
<br>
Added:<br>
    cfe/trunk/test/CodeGenObjC/debuginfo-properties.m<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=182176&r1=182175&r2=182176&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=182176&r1=182175&r2=182176&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri May 17 18:49:10 2013<br>
@@ -161,6 +161,13 @@ StringRef CGDebugInfo::getObjCMethodName<br>
              dyn_cast<const ObjCCategoryImplDecl>(DC)){<br>
       OS << ((const NamedDecl *)OCD)->getIdentifier()->getNameStart() << '(' <<<br>
           OCD->getIdentifier()->getNameStart() << ')';<br>
+  } else if (isa<const ObjCProtocolDecl>(DC)) {<br></blockquote><div><br></div><div style>You can drop the 'const' from the isa test.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+    // We can extract the type of the class from the self pointer.<br>
+    if (ImplicitParamDecl* SelfDecl = OMD->getSelfDecl()) {<br>
+      QualType ClassTy =<br>
+        cast<ObjCObjectPointerType>(SelfDecl->getType())->getPointeeType();<br>
+      ClassTy.print(OS, PrintingPolicy(LangOptions()));<br></blockquote><div><br></div><div style>Might be nice to add an overload (or default argument) for print - or maybe even an op<< for the stream.</div><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    }<br>
   }<br>
   OS << ' ' << OMD->getSelector().getAsString() << ']';<br>
<br>
<br>
Added: cfe/trunk/test/CodeGenObjC/debuginfo-properties.m<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debuginfo-properties.m?rev=182176&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debuginfo-properties.m?rev=182176&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/CodeGenObjC/debuginfo-properties.m (added)<br>
+++ cfe/trunk/test/CodeGenObjC/debuginfo-properties.m Fri May 17 18:49:10 2013<br>
@@ -0,0 +1,35 @@<br>
+// RUN: %clang_cc1 -g -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s<br>
+// Check that we emit the correct method names for properties from a protocol.<br>
+// rdar://problem/13798000<br>
+@protocol NSObject<br>
+- (id)init;<br>
+@end<br>
+@interface NSObject <NSObject> {}<br>
+@end<br>
+<br>
+@class Selection;<br>
+<br>
+@protocol HasASelection <NSObject><br>
+@property (nonatomic, retain) Selection* selection;<br>
+// CHECK: [ DW_TAG_subprogram ] [line [[@LINE-1]]] [local] [def] [-[MyClass selection]]<br>
+// CHECK: [ DW_TAG_subprogram ] [line [[@LINE-2]]] [local] [def] [-[MyClass setSelection:]]<br>
+// CHECK: [ DW_TAG_subprogram ] [line [[@LINE-3]]] [local] [def] [-[OtherClass selection]]<br>
+// CHECK: [ DW_TAG_subprogram ] [line [[@LINE-4]]] [local] [def] [-[OtherClass setSelection:]]<br>
+@end<br>
+<br>
+@interface MyClass : NSObject <HasASelection> {<br>
+  Selection *_selection;<br>
+}<br>
+@end<br>
+<br>
+@implementation MyClass<br>
+@synthesize selection = _selection;<br>
+@end<br>
+<br>
+@interface OtherClass : NSObject <HasASelection> {<br>
+  Selection *_selection;<br>
+}<br>
+@end<br>
+@implementation OtherClass<br>
+@synthesize selection = _selection;<br>
+@end<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">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>