xref: /llvm-project/clang-tools-extra/clang-tidy/modernize/UseUncaughtExceptionsCheck.h (revision 4718da506091a37ca4863d979bc541e359b79b10)
176e5023dSGabor Horvath //===--- UseUncaughtExceptionsCheck.h - clang-tidy------------*- C++ -*-===//
276e5023dSGabor Horvath //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
676e5023dSGabor Horvath //
776e5023dSGabor Horvath //===----------------------------------------------------------------------===//
876e5023dSGabor Horvath 
976e5023dSGabor Horvath #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_UNCAUGHT_EXCEPTIONS_H
1076e5023dSGabor Horvath #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_UNCAUGHT_EXCEPTIONS_H
1176e5023dSGabor Horvath 
12478fc5c8SAlexander Kornienko #include "../ClangTidyCheck.h"
1376e5023dSGabor Horvath 
14*4718da50SCarlos Galvez namespace clang::tidy::modernize {
1576e5023dSGabor Horvath 
1676e5023dSGabor Horvath /// This check will warn on calls to std::uncaught_exception and replace them with calls to
1776e5023dSGabor Horvath /// std::uncaught_exceptions, since std::uncaught_exception was deprecated in C++17. In case of
1876e5023dSGabor Horvath /// macro ID there will be only a warning without fixits.
1976e5023dSGabor Horvath ///
2076e5023dSGabor Horvath /// For the user-facing documentation see:
216e566bc5SRichard /// http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-uncaught-exceptions.html
2276e5023dSGabor Horvath class UseUncaughtExceptionsCheck : public ClangTidyCheck {
2376e5023dSGabor Horvath public:
UseUncaughtExceptionsCheck(StringRef Name,ClangTidyContext * Context)2476e5023dSGabor Horvath   UseUncaughtExceptionsCheck(StringRef Name, ClangTidyContext *Context)
2576e5023dSGabor Horvath       : ClangTidyCheck(Name, Context) {}
isLanguageVersionSupported(const LangOptions & LangOpts)26e40a742aSNathan James   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
27e40a742aSNathan James     return LangOpts.CPlusPlus17;
28e40a742aSNathan James   }
2976e5023dSGabor Horvath   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
3076e5023dSGabor Horvath   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
3176e5023dSGabor Horvath };
3276e5023dSGabor Horvath 
33*4718da50SCarlos Galvez } // namespace clang::tidy::modernize
3476e5023dSGabor Horvath 
3576e5023dSGabor Horvath #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_UNCAUGHT_EXCEPTIONS_H
36