clang-tools
3.8.0
Main Page
Namespaces
Classes
Files
File List
File Members
work
release-test
final
docsbuild
llvm.src
tools
clang
tools
extra
clang-tidy
misc
StaticAssertCheck.h
Go to the documentation of this file.
1
//===--- StaticAssertCheck.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_MISC_STATICASSERTCHECK_H
11
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_STATICASSERTCHECK_H
12
13
#include "../ClangTidy.h"
14
#include "llvm/ADT/StringRef.h"
15
#include <string>
16
17
namespace
clang {
18
namespace
tidy {
19
20
/// Replaces `assert()` with `static_assert()` if the condition is evaluatable
21
/// at compile time.
22
///
23
/// The condition of `static_assert()` is evaluated at compile time which is
24
/// safer and more efficient.
25
class
StaticAssertCheck
:
public
ClangTidyCheck
{
26
public
:
27
StaticAssertCheck
(StringRef
Name
,
ClangTidyContext
*
Context
);
28
void
registerMatchers
(ast_matchers::MatchFinder *
Finder
)
override
;
29
void
check
(
const
ast_matchers::MatchFinder::MatchResult &
Result
)
override
;
30
31
private
:
32
SourceLocation getLastParenLoc(
const
ASTContext *ASTCtx,
33
SourceLocation AssertLoc);
34
};
35
36
}
// namespace tidy
37
}
// namespace clang
38
39
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MISC_STATICASSERTCHECK_H
Name
StringHandle Name
Definition:
PreprocessorTracker.cpp:525
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::StaticAssertCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register ASTMatchers with Finder.
Definition:
StaticAssertCheck.cpp:29
clang::tidy::StaticAssertCheck::StaticAssertCheck
StaticAssertCheck(StringRef Name, ClangTidyContext *Context)
Definition:
StaticAssertCheck.cpp:26
clang::tidy::StaticAssertCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition:
StaticAssertCheck.cpp:72
clang::tidy::StaticAssertCheck
Replaces assert() with static_assert() if the condition is evaluatable at compile time...
Definition:
StaticAssertCheck.h:25
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
Result
const NamedDecl * Result
Definition:
USRFinder.cpp:121
Generated on Mon Mar 7 2016 09:54:12 for clang-tools by
1.8.6