23#include "llvm/Support/Process.h"
33class DominatorsTreeDumper :
public Checker<check::ASTCodeBody> {
50bool ento::shouldRegisterDominatorsTreeDumper(
const CheckerManager &mgr) {
59class PostDominatorsTreeDumper :
public Checker<check::ASTCodeBody> {
76bool ento::shouldRegisterPostDominatorsTreeDumper(
const CheckerManager &mgr) {
85class ControlDependencyTreeDumper :
public Checker<check::ASTCodeBody> {
97void ento::registerControlDependencyTreeDumper(
CheckerManager &mgr) {
101bool ento::shouldRegisterControlDependencyTreeDumper(
const CheckerManager &mgr) {
110class LiveVariablesDumper :
public Checker<check::ASTCodeBody> {
125bool ento::shouldRegisterLiveVariablesDumper(
const CheckerManager &mgr) {
134class LiveExpressionsDumper :
public Checker<check::ASTCodeBody> {
148bool ento::shouldRegisterLiveExpressionsDumper(
const CheckerManager &mgr) {
157class CFGViewer :
public Checker<check::ASTCodeBody> {
181class CFGDumper :
public Checker<check::ASTCodeBody> {
186 Policy.TerseOutput =
true;
187 Policy.PolishForDeclaration =
true;
188 D->
print(llvm::errs(), Policy);
192 llvm::sys::Process::StandardErrHasColors());
211class CallGraphViewer :
public Checker< check::ASTDecl<TranslationUnitDecl> > {
226bool ento::shouldRegisterCallGraphViewer(
const CheckerManager &mgr) {
235class CallGraphDumper :
public Checker< check::ASTDecl<TranslationUnitDecl> > {
250bool ento::shouldRegisterCallGraphDumper(
const CheckerManager &mgr) {
259class ConfigDumper :
public Checker< check::EndOfTranslationUnit > {
262 static int compareEntry(
const Table::MapEntryTy *
const *LHS,
263 const Table::MapEntryTy *
const *RHS) {
264 return (*LHS)->getKey().compare((*RHS)->getKey());
274 for (
const auto &Entry : Config)
275 Keys.push_back(&Entry);
276 llvm::array_pod_sort(Keys.begin(), Keys.end(), compareEntry);
278 llvm::errs() <<
"[config]\n";
279 for (
unsigned I = 0,
E = Keys.size(); I !=
E; ++I)
280 llvm::errs() << Keys[I]->getKey() <<
" = "
281 << (Keys[I]->second.empty() ?
"\"\"" : Keys[I]->second)
300class ExplodedGraphViewer :
public Checker< check::EndAnalysis > {
302 ExplodedGraphViewer() {}
314bool ento::shouldRegisterExplodedGraphViewer(
const CheckerManager &mgr) {
324class ReportStmts :
public Checker<check::PreStmt<Stmt>> {
325 BugType BT_stmtLoc{
this,
"Statement"};
334 std::make_unique<PathSensitiveBugReport>(BT_stmtLoc,
"Statement",
Node);
336 C.emitReport(std::move(Report));
AnalysisDeclContext contains the context data for the function, method or block under analysis.
ConfigTable Config
A key-value table of use-specified configuration values.
llvm::StringMap< std::string > ConfigTable
Dominator tree builder for Clang's CFG based on llvm::DominatorTreeBase.
void dump()
Dumps immediate dominators for each block.
void buildDominatorTree(CFG *cfg)
Builds the dominator tree for a given CFG.
Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt.
The AST-based call graph.
void addToCallGraph(Decl *D)
Populate the call graph with the functions in the given declaration.
Decl - This represents one declaration (or definition), e.g.
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
Stmt - This represents one statement.
The top declaration context.
const LangOptions & getLangOpts() const
AnalysisDeclContext * getAnalysisDeclContext(const Decl *D)
SourceManager & getSourceManager() override
T * getAnalysis(Decl const *D)
AnalyzerOptions & options
CFG * getCFG(Decl const *D)
BugReporter is a utility class for generating PathDiagnostics for analysis.
CHECKER * registerChecker(AT &&... Args)
Used to register checkers.
void ViewGraph(bool trim=false)
Visualize the ExplodedGraph created by executing the simulation.
The JSON file list parser is used to communicate input to InstallAPI.
Describes how types, statements, expressions, and declarations should be printed.