[PATCH] D57100: [clang-tidy] refactor bugprone-exception-escape analysis into class

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 23 07:31:13 PST 2019


JonasToth added a comment.

In D57100#1367813 <https://reviews.llvm.org/D57100#1367813>, @lebedev.ri wrote:

> Two passing-by remarks:
>
> 1. I would *love* for this check to produce less cryptic reports :) It currently does not output any details whatsoever. It's really unhelpful.


I would do that in a second refactoring. As it is now possible to have state within the analysis it should be possible to extract a path that lead to the exception. I think the 'highest' throwing function should be noted as the source.

  void indirect_throw() { call_something_throwing(); }
  void diagnose() noexcept {
  // warning: this function can throw
  
    indirect_throw();
    // note: this function is not safe to call
  }



> 2. It would be great for it to be generalized to not only detect the escaping of exceptions out of functions, but out of "statements" too. Namely, i would love some better handling of openmp directives. I might look into that later.

The internals can handle `Stmt` already and do traverse all statements of a `FunctionDecl`, so it should be possible to expose that.
Can OpenMP directives throw?

I think making this class and its interface is the first step to both features, incremental improvements are then easier to do.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57100/new/

https://reviews.llvm.org/D57100





More information about the cfe-commits mailing list