steakhal wrote:

> I'm seconding the suggestions of @steakhal, and in particular I agree with
> 
> > I'd also advise against using more callables bundled with CallDescriptions. 
> > They make debugging code more difficult, as the control-flow would become 
> > also data-dependent. I'd suggest other ways to generalize.
> 
> Instead of creating this shared framework that calls different callbacks 
> depending on the checked function, consider keeping separate top-level 
> evaluator functions that rely on a shared set of smaller tool-like helper 
> functions.

One more not about composability.
In general, `addTransition` calls don't compose, thus limits reusability.
For example, `preReadWrite` should be reusable from other precondition 
handlers, such that the new one can just call `preReadWrite` and then do some 
other more specialized checks. However, once a handler calls `addTransition` we 
are done. We no longer can simply wrap it, aka. compose with other 
functionalities.
Consequently, I'd suggest to have some common pattern, such as return state 
pointers, or NULL if an error was reported. And leave the `addTransition` to 
the caller - if they chose to call it.

`eval*` handlers are more difficult to compose, given that they also need to 
bind the return value and apply their sideffects, but I believe we could 
achieve similar objectives there too (thus, have refined, composable handlers, 
combined in useful ways).

https://github.com/llvm/llvm-project/pull/79312
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to