ymand wrote:

> I agree with the usefulness of storing the initial target separately, 
> reducing checks and branching based on whether the current target is a `Stmt` 
> or `Function`. Since I was touching everywhere `CallStack` was used anyway, I 
> went ahead with not pushing the starting `FunctionDecl` onto that stack.

Thanks!

> I wasn't immediately able to reduce the `initialize` duplication for 
> statements and function bodies since `buildResultObjectMap` and 
> `initFieldsGlobalsAndFuncs`, via `getReferencedDecls`, both handle 
> `FunctionDecl`s and `Stmt`s differently, pulling info from a `FunctionDecl` 
> beyond just its body. If templating `initFieldsGlobalsAndFuncs` is really 
> undesirable, I could either pass in the `ReferencedDecls` from current 
> callers or insert an intermediate with two overloads that takes the 
> `Stmt`/`FunctionDecl` and passes along the `ReferencedDecls`.

I'm generally allergic to templates unless necessary, but that doesn't mean I'm 
right :) I'm inclined towards either of the solutions you suggested involving 
passing `ReferencedDecls` (with a slight, arbitrary preference for the first 
since it involves fewer new function declarations), but I leave it up to you 
since you're actually writing the code and have a better view as to which 
solution is cleaner. Also happy to hear from other reviewers.



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

Reply via email to