[PATCH] D59650: [NFC] ExceptionEscapeCheck: small refactoring

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 21 13:38:45 PDT 2019


lebedev.ri added a comment.

In D59650#1438515 <https://reviews.llvm.org/D59650#1438515>, @JonasToth wrote:

> Why not having normal overloads? The analysis for `Stmt` is implemented with the private methods. Explicit template specialization is a bit overkill and so easily understood (but not too complex in this case either).l


The alternative is to add something like:

  ExceptionAnalyzer::ExceptionInfo
  ExceptionAnalyzer::analyze(const Stmt *Stmt) {
    ExceptionInfo ExceptionList;
  
    llvm::SmallSet<const FunctionDecl *, 32> CallStack;
    ExceptionList = throwsException(Func, CallStack);
  
    if (ExceptionList.getBehaviour() == State::NotThrowing ||
        ExceptionList.getBehaviour() == State::Unknown)
      return ExceptionList;
  
    // Remove all ignored exceptions from the list of exceptions that can be
    // thrown.
    ExceptionList.filterIgnoredExceptions(IgnoredExceptions, IgnoreBadAlloc);
  
    return ExceptionList;
  }

.. which ends up duplicating all of the boilerplate (blacklist in particular)
from `ExceptionAnalyzer::analyze(const FunctionDecl *Func)`.

Looks like pointless code duplication that is easily avoidable.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D59650





More information about the cfe-commits mailing list