[cfe-dev] Ensure name doesn't already exist

Daniel Dilts diltsman at gmail.com
Thu Jul 3 10:31:05 PDT 2014


I seem to remember reading somewhere that you could implement autocomplete
using Clang, and it would list all symbols that are valid at that
location.  Couldn't something like this be done to determine if a name
already exists at a location?


On Thu, Jul 3, 2014 at 6:02 AM, Manuel Klimek <klimek at google.com> wrote:

> On Tue, Jul 1, 2014 at 9:11 PM, Daniel Dilts <diltsman at gmail.com> wrote:
>
>> I am possibly renaming a class.  I would like to make sure that the new
>> name doesn't already exist.  Given that I am generating the new name, I
>> have it in a std::string.
>>
>> How would I check to see if there is already something with the new name
>> in the DeclContext?  I assume I would use DeclContext::lockup of some
>> flavor.  Also, the new name does not specify any namespaces (no :: anywhere
>> in it).
>>
>
> Unfortunately that's basically impossible in C++ (argument dependent
> lookup etc). But the easy cases should be handled by doing
> DeclContext::lookup throught all parent contexts.
>
>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140703/e5356aca/attachment.html>


More information about the cfe-dev mailing list