clang-tools  6.0.0
UseNoexceptCheck.h
Go to the documentation of this file.
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
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
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Replace dynamic exception specifications, with noexcept (or user-defined macro) or noexcept(false)...
StringHandle Name
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
std::map< std::string, std::string > OptionMap
UseNoexceptCheck(StringRef Name, ClangTidyContext *Context)
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...