diff options
author | Jonas Toth <jonas.toth@gmail.com> | 2019-02-20 21:04:36 +0000 |
---|---|---|
committer | Jonas Toth <jonas.toth@gmail.com> | 2019-02-20 21:04:36 +0000 |
commit | a0bcbdb5c50e1909efd6acc916fd8cd4b3ff4c41 (patch) | |
tree | 2559d06813df8d3832fbcb4268c3da6867d12449 /clang-tidy/bugprone | |
parent | fae848526cdda3c07318f881b6f88056071012e9 (diff) |
[clang-tidy] refactor ExceptionAnalyzer further to give ternary answer
Summary:
The analsis on the throwing behvaiour on functions and statements gave only
a binary answer whether an exception could occur and if yes which types are
thrown.
This refactoring allows keeping track if there is a unknown factor, because the
code calls to some functions with unavailable source code with no `noexcept`
information.
This 'potential Unknown' information is propagated properly and can be queried
separately.
Reviewers: lebedev.ri, aaron.ballman, baloghadamsoftware, alexfh
Reviewed By: lebedev.ri, baloghadamsoftware
Subscribers: xazax.hun, rnkovacs, a.sidorin, Szelethus, donat.nagy, dkrupp, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57883
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@354517 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/bugprone')
-rw-r--r-- | clang-tidy/bugprone/ExceptionEscapeCheck.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang-tidy/bugprone/ExceptionEscapeCheck.cpp b/clang-tidy/bugprone/ExceptionEscapeCheck.cpp index 0849e2e7..951c6f1e 100644 --- a/clang-tidy/bugprone/ExceptionEscapeCheck.cpp +++ b/clang-tidy/bugprone/ExceptionEscapeCheck.cpp @@ -42,6 +42,7 @@ ExceptionEscapeCheck::ExceptionEscapeCheck(StringRef Name, IgnoredExceptions.insert(IgnoredExceptionsVec.begin(), IgnoredExceptionsVec.end()); Tracer.ignoreExceptions(std::move(IgnoredExceptions)); + Tracer.ignoreBadAlloc(true); } void ExceptionEscapeCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { @@ -70,7 +71,8 @@ void ExceptionEscapeCheck::check(const MatchFinder::MatchResult &Result) { if (!MatchedDecl) return; - if (Tracer.throwsException(MatchedDecl)) + if (Tracer.analyze(MatchedDecl).getBehaviour() == + utils::ExceptionAnalyzer::State::Throwing) // FIXME: We should provide more information about the exact location where // the exception is thrown, maybe the full path the exception escapes diag(MatchedDecl->getLocation(), |