blob: a15867bdfd8ae4597feba86f77ccb98412a3412b [file] [log] [blame]
Alexander Kornienko08936e42017-06-08 14:04:16 +00001//===--- UseNoexceptCheck.h - clang-tidy-------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_NOEXCEPT_H
11#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_NOEXCEPT_H
12
13#include "../ClangTidy.h"
14
15namespace clang {
16namespace tidy {
17namespace modernize {
18
19/// \brief Replace dynamic exception specifications, with
20/// `noexcept` (or user-defined macro) or `noexcept(false)`.
21/// \code
22/// void foo() throw();
23/// void bar() throw(int);
24/// \endcode
25/// Is converted to:
26/// \code
27/// void foo() ;
Simon Pilgrim14964682017-06-08 17:01:01 +000028/// void bar() noexcept(false);
Alexander Kornienko08936e42017-06-08 14:04:16 +000029/// \endcode
30///
31/// For the user-facing documentation see:
32/// http://clang.llvm.org/extra/clang-tidy/checks/modernize-use-noexcept.html
33class UseNoexceptCheck : public ClangTidyCheck {
34public:
35 UseNoexceptCheck(StringRef Name, ClangTidyContext *Context);
36 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
37 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
38 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
39
40private:
41 const std::string NoexceptMacro;
42 bool UseNoexceptFalse;
43};
44
45} // namespace modernize
46} // namespace tidy
47} // namespace clang
48
49#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_NOEXCEPT_H