Ericsson / clang

Cross Translation Unit analysis capability for Clang Static Analyzer. (Fork of official clang at http://llvm.org/git/clang)
http://clang.llvm.org/
Other
15 stars 10 forks source link

Previously found Decl should be linked right after create #506

Open martong opened 5 years ago

martong commented 5 years ago

Import starts with a lookup and then we create a new Decl. Then in certain cases (e.g. CXXConstructorDecl) we further import other Decls (base classes, members through CXXConstructorDecl::inits()) before connecting the redecl chain. During those in-between imports structural eq fails because the canonical decl is different.

Currently this problem impacts only CXXConstructorDecl, however we plan to properly import the redecl chains in other kind of Decls too. Thus, we should add a new PrevDecl parameter to GetImportedOrCreateDecl on a long term.

martong commented 5 years ago

This implies that first we have to implement the import of the redecl chains for all nodes. E.g. EnumDecl, VarTemplateDecl, and lot of other nodes still do not handle the redecl chain properly.