[cfe-dev] clang-tidy and static analysis for exception safety

Jonas Toth via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 16 02:08:11 PDT 2017


Hello everybody,

I want to implement an check for proper exception specification 
(noexcept correctness). In code review aaron.ballman pointed out that 
there is path sensitive analysis necessary. Since i have no experience 
and knowledge on that I would like to have some input from experienced 
programmers on that topic.

What should be possible with AST - Matching in clang-tidy:

- a function calling only `noexcept` operations that does not throw can 
be marked noexcept
- a function that has a `throw` statement not within a `try/catch` 
block can be marked noexcept(false)
- a function calling a function that is not marked noexcept can not be 
marked noexcept
   but it could be noexecpt with deeper analysis on what exception 
could be thrown and what exceptions are handled

Having logic for these cases would allow to automatically improve 
noexcept-correctness.
Maybe more importantly it would be possible to find destructors and 
deallocation functions that could throw but never should.

Is there already functionality for such analysis, is my model even 
correct and how hard would the analysis be?
I have no experience in CSA development but iam fairly interested in it 
and would like to learn if reasonably complicated.

All the best
Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170316/28656619/attachment.html>


More information about the cfe-dev mailing list