timon-ul wrote:

I figured out the mistery. For starters I tried a simple test with multiple 
redeclarations and checked in which order they were presented. And indeed the 
Index starts with the first declaration and goes through them by order 
(1->2->3->4->5). Meanwhile the AST starts with the last one and then goes 
through the rest by order (5->1->2->3->4). I then decided to check the class 
documentation of 
[Redeclarable.h](https://searchfox.org/llvm/source/clang/include/clang/AST/Redeclarable.h#32)
 and the first line explains what is going on. As I noted earlier we only ever 
reach this code with a single declaration, there seems to be a prevention at 
some point that multiple reach it. So for the Index we change to the first 
declaration, but for the AST it seems like we just throw in the last. So since 
the redeclarations are a circular linked list we start with the first for the 
Index, but with the last one on the AST path. Did not expect it to work this 
way, but makes sense that it happens this way then. The fix is quite easy, just 
have it ask for the first declaration before asking for the redeclarations.

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

Reply via email to