On 13 Oct, 2011,at 06:26 PM, Douglas Gregor <dgregor@applecom> wrote:

--- a/include/clang/Sema/CodeCompleteConsumer.h
+++ b/include/clang/Sema/CodeCompleteConsumer.h
@@ -435,12 +435,15 @@ private:

/// \brief The availability of this code-completion result.
unsigned Availability : 2;
+
+ unsigned NumAnnotations;

Shouldn't we use less than 32 bits for the number of annotations?
 
I changed it to unsigned NumAnnotations : 8 but with alignment I do not know if this will have any impact. Also, there is a unsigned NumChunks (so a full 32 bit unsigned), which I guess is also be a bit on the large side. So maybe I should give them both a :16?


+CXString clang_getCompletionAnnotation(CXCompletionString completion_string,
+ unsigned annotation_number) {
+ CodeCompletionString *CCStr = (CodeCompletionString *)completion_string;
+ return CCStr? createCXString(CCStr->getAnnotation(annotation_number))
+ : createCXString((const char *) 0);
+}
+

Returning an empty CXString to mean "no more annotations" makes for a very subtle distinction with, e.g.,

int blah __attribute__((annotate("one"), annotate(""), annotate("three")));

I'd feel slightly better if there were a clang_getCompletionNumAnnotations(CXCompletionString) function for the client to use.
 
Done, and I added that line above to the test. New patch attached.

-- Erik.

Attachment: 0001-Added-clang_getCompletionAnnotation-and-clang_getCom.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to