steakhal wrote:

The CFG construction doesn't seem to be the right place to propagate noreturn 
attributes. It is already fairly complicated and the annotations seem like an 
orthogonal concern.

Adding deduced attributes should be a separate step in the ASTConsumers 
pipeline.
We take the AST, do some analysis and mutate the AST by adding the deduced 
attributes to the relevant AST nodes, and only to those where it makes sense.

This worked for us downstream for a similar use-cases. This also side-steps 
patching the CFG construction, because by the time we get there, we are already 
done with the annotation phase thus, it would see the implict (deduced) 
`analyzer_noreturn` attributes.

We build the CallGraph and iterate it in Post-order to make sure leaf calls are 
inferred first, thus the callers would get to see the deduced 
`analyzer_noreturn` attributes too and build from the bottom up.

If I had time, I could probably try to upstream this part.

The beauty of this approach is that its a separate component, and we would not 
need to piggyback on a default bool parameter of the `analyzer_noreturn` 
attribute.

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

Reply via email to