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

Enforce that node ctors in "to" ctx get params from the "to" ctx #649

Open martong opened 5 years ago

martong commented 5 years ago

I was wondering how could we avoid these errors when a node from the "from" context is passed to a constructor of a node in the "to"context. This came up with the Concepts patches: E.g. https://reviews.llvm.org/D43357#inline-538221 Since GetImportedOrCreateDecl is the one which forwards the nodes as parameters, maybe with some template metaprogramming we could enforce that all the forwarded nodes are in the "to" context ... but it is still not a full coverage because there are nodes with additional setSubexpression() functions which may be called after create: https://reviews.llvm.org/D44352#inline-538212