24 #include "llvm/Support/Process.h" 26 using namespace clang;
34 class DominatorsTreeDumper :
public Checker<check::ASTCodeBody> {
56 class LiveVariablesDumper :
public Checker<check::ASTCodeBody> {
76 class CFGViewer :
public Checker<check::ASTCodeBody> {
96 class CFGDumper :
public Checker<check::ASTCodeBody> {
102 Policy.PolishForDeclaration =
true;
103 D->
print(llvm::errs(), Policy);
107 llvm::sys::Process::StandardErrHasColors());
122 class CallGraphViewer :
public Checker< check::ASTDecl<TranslationUnitDecl> > {
142 class CallGraphDumper :
public Checker< check::ASTDecl<TranslationUnitDecl> > {
163 class ConfigDumper :
public Checker< check::EndOfTranslationUnit > {
166 static int compareEntry(
const Table::MapEntryTy *
const *LHS,
167 const Table::MapEntryTy *
const *RHS) {
168 return (*LHS)->getKey().compare((*RHS)->getKey());
178 for (Table::const_iterator I = Config.begin(), E = Config.end(); I != E;
181 llvm::array_pod_sort(Keys.begin(), Keys.end(), compareEntry);
183 llvm::errs() <<
"[config]\n";
184 for (
unsigned I = 0, E = Keys.size(); I != E; ++I)
185 llvm::errs() << Keys[I]->getKey() <<
" = " << Keys[I]->second <<
'\n';
187 llvm::errs() <<
"[stats]\n" <<
"num-entries = " << Keys.size() <<
'\n';
201 class ExplodedGraphViewer :
public Checker< check::EndAnalysis > {
203 ExplodedGraphViewer() {}
The AST-based call graph.
void dump()
This method dumps immediate dominators for each block, mainly used for debug purposes.
Decl - This represents one declaration (or definition), e.g.
Describes how types, statements, expressions, and declarations should be printed. ...
unsigned TerseOutput
Provide a 'terse' output.
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
AnalysisDeclContext contains the context data for the function or method under analysis.
Concrete subclass of DominatorTreeBase for Clang This class implements the dominators tree functional...
AnalysisDeclContext * getAnalysisDeclContext(const Decl *D)
CFG - Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt...
void buildDominatorTree(AnalysisDeclContext &AC)
This method builds the dominator tree for a given CFG The CFG information is passed via AnalysisDeclC...
CFG * getCFG(Decl const *D)
BugReporter is a utility class for generating PathDiagnostics for analysis.
CHECKER * registerChecker()
Used to register checkers.
ConfigTable Config
A key-value table of use-specified configuration values.
AnalyzerOptions & options
SourceManager & getSourceManager() override
Dataflow Directional Tag Classes.
const LangOptions & getLangOpts() const
llvm::StringMap< std::string > ConfigTable
void addToCallGraph(Decl *D)
Populate the call graph with the functions in the given declaration.
TranslationUnitDecl - The top declaration context.
void ViewGraph(bool trim=false)
Visualize the ExplodedGraph created by executing the simulation.
T * getAnalysis(Decl const *D)