ChuanqiXu9 wrote:

> I thought that modules was using the AST structural equivalence code as well

No, as far as I know. In modules, it looks like only ObjC uses AST structural 
equivalence. In C++, we use the previously mentioned ODRHash mechanism to judge 
if two AST Definition are the same.

> if you confirm, do you think we should do the C++ changes as well, either in 
> this PR or a follow-up? Or is there a better way for us to structure the code 
> for sharing?

I guess a reason why we use ODRHash is that, we want to avoid deserializing a 
declaration if possible. That is, for AST structural equivalence, we need the 
full AST structure. But in serialization, if we're comparing the identification 
of two classes (which may not be deserialized fully yet), it will be much 
better if we're able to compare the unsigned int directly. This may be the 
reason why we have ODRHash.

This is historical. CC @zygoloid if you know the reason modules code use 
ODRHash instead of AST structural equivalence in the first place.


https://github.com/llvm/llvm-project/pull/168769
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to