clang-tools  7.0.0
ExceptionEscapeCheck.h
Go to the documentation of this file.
1 //===--- ExceptionEscapeCheck.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_BUGPRONE_EXCEPTION_ESCAPE_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_EXCEPTION_ESCAPE_H
12 
13 #include "../ClangTidy.h"
14 
15 #include "llvm/ADT/StringSet.h"
16 
17 namespace clang {
18 namespace tidy {
19 namespace bugprone {
20 
21 /// Finds functions which should not throw exceptions: Destructors, move
22 /// constructors, move assignment operators, the main() function,
23 /// swap() functions, functions marked with throw() or noexcept and functions
24 /// given as option to the checker.
25 ///
26 /// For the user-facing documentation see:
27 /// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-exception-escape.html
29 public:
30  ExceptionEscapeCheck(StringRef Name, ClangTidyContext *Context);
31  void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
32  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
33  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
34 
35 private:
36  std::string RawFunctionsThatShouldNotThrow;
37  std::string RawIgnoredExceptions;
38 
39  llvm::StringSet<> FunctionsThatShouldNotThrow;
40  llvm::StringSet<> IgnoredExceptions;
41 };
42 
43 } // namespace bugprone
44 } // namespace tidy
45 } // namespace clang
46 
47 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_EXCEPTION_ESCAPE_H
llvm::StringRef Name
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
std::map< std::string, std::string > OptionMap
Finds functions which should not throw exceptions: Destructors, move constructors, move assignment operators, the main() function, swap() functions, functions marked with throw() or noexcept and functions given as option to the checker.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
ExceptionEscapeCheck(StringRef Name, ClangTidyContext *Context)