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