<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div><br></div><div>On Jul 25, 2011, at 4:13 PM, Connor Wakamo wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I've incorporated the changes that you suggested.  Please let me know if there is anything else I need to change.<br><div>
<span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br class="Apple-interchange-newline">Thanks,</div><div>Connor Wakamo</div><div><a href="mailto:cwakamo@apple.com">cwakamo@apple.com</a></div></div></span>
</div>

<div><br></div></div><span><clang_codeCompleteGetObjCSelector.patch></span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div><br></div><div>On Jul 25, 2011, at 11:10 AM, Douglas Gregor wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On Jul 22, 2011, at 5:30 PM, Connor Wakamo wrote:<br><br><blockquote type="cite">I am submitting for review a patch with a new API function for libclang:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">This function returns a string containing the selector parts that have been typed thus far when code completion is requested for an Objective-C message.  For instance, if you're asking for completions after "[Foo initWithBar:bar object:obj", it'll return "initWithBar:object:".<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I've also added some additional output to c-index-test and added a couple of checks in test/Index/complete-objc-message.m for both class and instance messages.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Please let me know what else I need to do with this patch.<br></blockquote><br>Cool. A couple comments:<br><br>Index: tools/libclang/CIndexCodeCompletion.cpp<br>===================================================================<br>--- tools/libclang/CIndexCodeCompletion.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 135677)<br>+++ tools/libclang/CIndexCodeCompletion.cpp<span class="Apple-tab-span" style="white-space:pre">      </span>(working copy)<br>@@ -247,10 +247,17 @@<br>   /// current context.<br>   unsigned long long Contexts;<br><br>+  /// \brief The kind of the container for the current context for completions.<br>   enum CXCursorKind ContainerKind;<br>+  /// \brief The USR of the container for the current context for completions.<br>   CXString ContainerUSR;<br>+  /// \brief a boolean value indicating whether there is complete information<br>+  /// about the container<br>+  unsigned ContainerIsIncomplete;<br><br>-  unsigned ContainerIsIncomplete;<br>+  /// \brief A string containing the Objective-C selector entered thus far for a<br>+  /// message send.<br>+  char *Selector;<br> };<br><br>Please use a std::string for Selector, so we don't have to manually manage the memory.<br><br>+      if (Context.getNumSelIdents() > 0) {<br>+        printf("We have selector parts to save!\n");<br><br>Please drop the printf.<br><br>+        size_t selectorLength = 0;<br>+        for (unsigned i = 0; i < Context.getNumSelIdents(); i++) {<br>+          StringRef selectorString = Context.getSelIdents()[i]->getName();<br>+          selectorLength += selectorString.size();<br>+        }<br><br>the IdentifierInfo* within a selector can actually be NULL, so make sure you check for it first. That's how we represent such ill-advised selectors as<br><br><span class="Apple-tab-span" style="white-space:pre">      </span>foo::bar:<br><br>+        char *selectorString = (char *)malloc(selectorLength +<br>+                                              Context.getNumSelIdents() + 1);<br>+        if (selectorString) {<br>+          for (unsigned i = 0; i < Context.getNumSelIdents(); i++) {<br>+            strcat(selectorString, Context.getSelIdents()[i]->getName().data());<br>+            strcat(selectorString, ":");<br>+          }<br>+        }<br>+        AllocatedResults.Selector = selectorString;<br><br>This will be way easier with std::string :)<br><br>Index: tools/libclang/libclang.darwin.exports<br>===================================================================<br>--- tools/libclang/libclang.darwin.exports<span class="Apple-tab-span" style="white-space:pre">     </span>(revision 135677)<br>+++ tools/libclang/libclang.darwin.exports<span class="Apple-tab-span" style="white-space:pre">       </span>(working copy)<br>@@ -9,6 +9,9 @@<br> _clang_codeCompleteGetContainerKind<br> _clang_codeCompleteGetContainerUSR<br> _clang_codeCompleteGetContexts<br>+_clang_codeCompleteGetContainerKind<br>+_clang_codeCompleteGetContainerUSR<br>+_clang_codeCompleteGetObjCSelector<br> _clang_constructUSR_ObjCCategory<br> _clang_constructUSR_ObjCClass<br> _clang_constructUSR_ObjCIvar<br>Index: tools/libclang/libclang.exports<br>===================================================================<br>--- tools/libclang/libclang.exports<span class="Apple-tab-span" style="white-space:pre">     </span>(revision 135677)<br>+++ tools/libclang/libclang.exports<span class="Apple-tab-span" style="white-space:pre">      </span>(working copy)<br>@@ -9,6 +9,9 @@<br> clang_codeCompleteGetContainerKind<br> clang_codeCompleteGetContainerUSR<br> clang_codeCompleteGetContexts<br>+clang_codeCompleteGetContainerKind<br>+clang_codeCompleteGetContainerUSR<br>+clang_codeCompleteGetObjCSelector<br> clang_constructUSR_ObjCCategory<br> clang_constructUSR_ObjCClass<br> clang_constructUSR_ObjCIvar<br><br>Some extraneous exports here from a prior patch.<br><br><span class="Apple-tab-span" style="white-space:pre">        </span>- Doug<br><br></div></blockquote></div><br></div>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits<br></blockquote></div><br></body></html>