On 6 July 2011 23:16, Connor Wakamo <[email protected]> wrote:
>> + case CodeCompletionContext::CCC_MacroName:
>>
>> This maps to CXCompletionContext_MacroName?
>
> Actually, it doesn't. It might be a case where the value names are a bit
> confusing, and let me know if I should change it, but CCC_MacroName means
> that code completion is occurring where a macro is being defined and it needs
> a name. (At least, that's what the comment says in
> Sema/CodeCompleteConsumer.h.) I've mapped it to CXCompletionContext_Unknown,
> as I don't think it would be possible to suggest completions for a new name.
> (Correct me if I'm wrong on that.)
There are some case where it's theoretically possible to suggest a
sensible name for a new macro. For example:
#if USE_SOMETHING
#define FOO __attribute__((use_something))
#else
#define |
//...
(Where '|' is the cursor position for code completion)
You might be able to assume the user is trying to conditionally define
FOO here, so 'FOO' would be a sensible completion option. (As well as
any other macro defined in other #if(def) branches than the current
one)
Another case might be to suggest the name of a macro that has been
#undef'ed (in the current file?) but not yet redefined.
However, this would probably be a bit too much work, especially if it
would mean the compiler can no longer quickly skip unused #if
branches.
By the way, maybe 'CCC_NewMacroName' would be a better name for it?
It's less ambiguous.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits