[clang] [clang-tools-extra] [clang]: Propagate `*noreturn` attributes in `CFG` (PR #146355)

Andrey Karlov via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 25 08:09:44 PDT 2025


negativ wrote:

> 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.

Could you please point to some good example of using  ASTConsumers pipeline? 

> 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.

Wouldn't that mean we'd have to reimplement CFG's useful features like unreachable code detection?

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

I'I'd appreciate it if you could point me to parts of the codebase I could look at to learn and try implementing the feature myself =)

https://github.com/llvm/llvm-project/pull/146355


More information about the cfe-commits mailing list