22 #include "llvm/Support/Process.h"
24 using namespace clang;
32 class DominatorsTreeDumper :
public Checker<check::ASTCodeBody> {
54 class LiveVariablesDumper :
public Checker<check::ASTCodeBody> {
74 class CFGViewer :
public Checker<check::ASTCodeBody> {
94 class CFGDumper :
public Checker<check::ASTCodeBody> {
100 Policy.PolishForDeclaration =
true;
101 D->
print(llvm::errs(), Policy);
105 llvm::sys::Process::StandardErrHasColors());
120 class CallGraphViewer :
public Checker< check::ASTDecl<TranslationUnitDecl> > {
140 class CallGraphDumper :
public Checker< check::ASTDecl<TranslationUnitDecl> > {
161 class ConfigDumper :
public Checker< check::EndOfTranslationUnit > {
164 static int compareEntry(
const Table::MapEntryTy *
const *LHS,
165 const Table::MapEntryTy *
const *RHS) {
166 return (*LHS)->getKey().compare((*RHS)->getKey());
176 for (Table::const_iterator I = Config.begin(), E = Config.end(); I != E;
179 llvm::array_pod_sort(Keys.begin(), Keys.end(), compareEntry);
181 llvm::errs() <<
"[config]\n";
182 for (
unsigned I = 0, E = Keys.size(); I != E; ++I)
183 llvm::errs() << Keys[I]->getKey() <<
" = " << Keys[I]->second <<
'\n';
185 llvm::errs() <<
"[stats]\n" <<
"num-entries = " << Keys.size() <<
'\n';
199 class ExplodedGraphViewer :
public Checker< check::EndAnalysis > {
201 ExplodedGraphViewer() {}
The AST-based call graph.
void dump()
This method dumps immediate dominators for each block, mainly used for debug purposes.
Describes how types, statements, expressions, and declarations should be printed. ...
unsigned TerseOutput
Provide a 'terse' output.
Concrete subclass of DominatorTreeBase for Clang This class implements the dominators tree functional...
AnalysisDeclContext * getAnalysisDeclContext(const Decl *D)
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)
CHECKER * registerChecker()
Used to register checkers.
ConfigTable Config
A key-value table of use-specified configuration values.
AnalyzerOptions & options
SourceManager & getSourceManager() override
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) 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.
const LangOptions & getLangOpts() const
void ViewGraph(bool trim=false)
Visualize the ExplodedGraph created by executing the simulation.
T * getAnalysis(Decl const *D)