[PM] Redesign how the new PM detects whether an analysis result provides
its own invalidate method. Previously, the technique would assume that if a result didn't have an invalidate method that didn't exactly match the expected signature it didn't have one at all. This is in fact not the case. And we had analyses with incorrect signatures for the invalidate method in the tree that would be erroneously invalidated in certain cases! Yikes. Moreover a result might legitimately want to have multiple overloads for the invalidate method, and if one changes or a new one is needed we again really want a compiler error. For example in the tree we had not added the overload for a *function* IR unit to the invalidate routine for TLI. Doh. So a new techique for the SFINAE detection here: if the result has *any* member spelled "invalidate" we turn off the synthesis of a default version. We don't care if it is a member function or a member variable or how many overloads there are. Once a result has something by that name it must provide suitable overloads for the contexts in which it is used. This seems much more resilient and durable. Huge props to Richard Smith who helped me figure out how on earth we could even do this in C++. It took quite some doing. The technique is remarkably clean however, and merely requires that the analysis results are not *final* classes. I think that's a requirement we can live with even if it is a bit odd. I've fixed the two bad in-tree analysis results. And this will make my next change which changes the API for invalidate much easier to validate as correct. llvm-svn: 279217
Loading
Please register or sign in to comment