clang-tools 3.8.0

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

ProBoundsConstantArrayIndexCheck.h
Go to the documentation of this file.
1 //===--- ProBoundsConstantArrayIndexCheck.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_CPPCOREGUIDELINES_PRO_BOUNDS_CONSTANT_ARRAY_INDEX_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_PRO_BOUNDS_CONSTANT_ARRAY_INDEX_H
12
13 #include "../ClangTidy.h"
14 #include "../utils/IncludeInserter.h"
15
16 namespace clang {
17 namespace tidy {
18
19 /// This checks that all array subscriptions on static arrays and std::arrays
20 /// have a constant index and are within bounds
21 ///
22 /// For the user-facing documentation see:
23 /// http://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.html
24 class ProBoundsConstantArrayIndexCheck : public ClangTidyCheck {
25 const std::string GslHeader;
26 const IncludeSorter::IncludeStyle IncludeStyle;
27 std::unique_ptr<IncludeInserter> Inserter;
28
29 public:
30 ProBoundsConstantArrayIndexCheck(StringRef Name, ClangTidyContext *Context);
31 void registerPPCallbacks(CompilerInstance &Compiler) override;
32 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
33 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
34 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
35 };
36
37 } // namespace tidy
38 } // namespace clang
39
40 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CPPCOREGUIDELINES_PRO_BOUNDS_CONSTANT_ARRAY_INDEX_H
clang::tidy::ProBoundsConstantArrayIndexCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register ASTMatchers with Finder.
Definition: ProBoundsConstantArrayIndexCheck.cpp:43
clang::tidy::ProBoundsConstantArrayIndexCheck::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: ProBoundsConstantArrayIndexCheck.cpp:27
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
clang::tidy::IncludeSorter::IncludeStyle
IncludeStyle
Definition: IncludeSorter.h:26
Finder
std::unique_ptr< ast_matchers::MatchFinder > Finder
Definition: ClangTidy.cpp:188
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:102
clang::tidy::ProBoundsConstantArrayIndexCheck::ProBoundsConstantArrayIndexCheck
ProBoundsConstantArrayIndexCheck(StringRef Name, ClangTidyContext *Context)
Definition: ProBoundsConstantArrayIndexCheck.cpp:21
clang::tidy::ProBoundsConstantArrayIndexCheck
This checks that all array subscriptions on static arrays and std::arrays have a constant index and a...
Definition: ProBoundsConstantArrayIndexCheck.h:24
clang::tidy::ProBoundsConstantArrayIndexCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: ProBoundsConstantArrayIndexCheck.cpp:63
clang::tidy::ClangTidyOptions::OptionMap
std::map< std::string, std::string > OptionMap
Definition: ClangTidyOptions.h:82
Context
ClangTidyContext & Context
Definition: ClangTidy.cpp:93
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:124
clang::tidy::ProBoundsConstantArrayIndexCheck::registerPPCallbacks
void registerPPCallbacks(CompilerInstance &Compiler) override
Override this to register PPCallbacks with Compiler.
Definition: ProBoundsConstantArrayIndexCheck.cpp:33
Result
const NamedDecl * Result
Definition: USRFinder.cpp:121