[cfe-dev] Is it OK to directly compare CXFile?

Argyrios Kyrtzidis kyrtzidis at apple.com
Fri Jan 9 08:06:32 PST 2015


> On Jan 9, 2015, at 7:50 AM, Milian Wolff <mail at milianw.de> wrote:
> 
> On Friday 15 August 2014 17:37:03 Argyrios Kyrtzidis wrote:
>> Hi Milian,
>> 
>> Introduced clang_File_isEqual function in r215796.
> 
> Which version is this commit shipped in? My clang 3.5.0 does not contain this 
> function.

I added the function for future-proofing, but currently it is ok to directly compare CXFile.
When you update to the version that has it I’d recommend that you use the function.

> 
> Thanks
> 
>>> On Aug 7, 2014, at 5:20 AM, Milian Wolff <mail at milianw.de> wrote:
>>> 
>>> Hey,
>>> 
>>> using the clang-c API, there is no clang_equalFiles or similar. CXFile
>>> itself is just a typedef of void*. In our tests, we saw that these
>>> CXFile's are probably interned, i.e. you get the same ptr address for
>>> equal
>>> clang_getFileName's.
>>> 
>>> So - is it safe and OK to directly compare the ptr addresses stored in a
>>> CXFile? If so, could you please document this? If not, also document it,
>>> and add a clang_equalFiles?
>>> 
>>> Thanks
> 
> -- 
> Milian Wolff
> mail at milianw.de
> http://milianw.de





More information about the cfe-dev mailing list