Aaron Ballman | 8ec373a | 2017-01-26 22:34:24 +0000 | [diff] [blame] | 1 | //===--- 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 | |
| 15 | namespace clang { |
| 16 | namespace tidy { |
| 17 | namespace 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() ; |
| 28 | // void bar() noexcept(false); |
| 29 | /// \endcode |
| 30 | /// |
| 31 | /// For the user-facing documentation see: |
| 32 | /// http://clang.llvm.org/extra/clang-tidy/checks/modernize-use-noexcept.html |
| 33 | class UseNoexceptCheck : public ClangTidyCheck { |
| 34 | public: |
| 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 | |
| 40 | private: |
| 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 |