[cfe-commits] r75740 - in /cfe/trunk: include/clang/Index/Entity.h lib/Index/Entity.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Thu Jul 16 11:04:32 PDT 2009

On Jul 15, 2009, at 9:44 PM, Chris Lattner wrote:

> On Jul 14, 2009, at 9:39 PM, Zhongxing Xu wrote:
>> Author: zhongxingxu
>> Date: Tue Jul 14 23:39:21 2009
>> New Revision: 75740
>> URL: http://llvm.org/viewvc/llvm-project?rev=75740&view=rev
>> Log:
>> Add getName() method to Entity.
> Hi Zhongxing,
> I don't think this is a good idea.  Entity will be getting more
> complicated eventually to support things like objc selectors, C++
> templates, etc.  Eventually we want the ability to turn an Entity into
> a stable string representation (suitable for sticking in a database
> etc) but I don't think this should be called "getName()", it should be
> something like "getStableString()" or something like that.
> Argiris, what do you think?

We can name the methods that use/return a "string encoding" as method  
"getEncoding" and static method "getFromEncoding".

Apart from those, it seems useful to also a have a method that will  
return an easier to understand string for debugging purposes;
if we compare to the linker symbols, encoding will be the mangled name  
and a "getName" method will return the unmangled one.

Maybe "getName" should be renamed to "getPrintableName" to make its  
purpose more obvious ?

Also, getPrintableName should return a std::string, not a const char *.


More information about the cfe-commits mailing list