clang API Documentation
Classes | |
struct | VarDefinition |
Public Types | |
typedef LocalVarContext | Context |
Public Member Functions | |
LocalVariableMap () | |
const VarDefinition * | lookup (const NamedDecl *D, Context Ctx) |
Look up a definition, within the given context. | |
const Expr * | lookupExpr (const NamedDecl *D, Context &Ctx) |
Context | getEmptyContext () |
Context | getNextContext (unsigned &CtxIndex, Stmt *S, Context C) |
void | dumpVarDefinitionName (unsigned i) |
void | dump () |
Dumps an ASCII representation of the variable map to llvm::errs() | |
void | dumpContext (Context C) |
Dumps an ASCII representation of a Context to llvm::errs() | |
void | traverseCFG (CFG *CFGraph, const PostOrderCFGView *SortedGraph, std::vector< CFGBlockInfo > &BlockInfo) |
Builds the variable map. | |
Protected Member Functions | |
unsigned | getContextIndex () |
void | saveContext (Stmt *S, Context C) |
Context | addDefinition (const NamedDecl *D, const Expr *Exp, Context Ctx) |
Context | addReference (const NamedDecl *D, unsigned i, Context Ctx) |
Context | updateDefinition (const NamedDecl *D, Expr *Exp, Context Ctx) |
Context | clearDefinition (const NamedDecl *D, Context Ctx) |
Context | removeDefinition (const NamedDecl *D, Context Ctx) |
Context | intersectContexts (Context C1, Context C2) |
Context | createReferenceContext (Context C) |
void | intersectBackEdge (Context C1, Context C2) |
Friends | |
class | VarMapBuilder |
Definition at line 292 of file ThreadSafety.cpp.
Definition at line 294 of file ThreadSafety.cpp.
Definition at line 330 of file ThreadSafety.cpp.
References getEmptyContext().
Context clang::threadSafety::LocalVariableMap::addDefinition | ( | const NamedDecl * | D, |
const Expr * | Exp, | ||
Context | Ctx | ||
) | [inline, protected] |
Definition at line 434 of file ThreadSafety.cpp.
Referenced by clang::threadSafety::VarMapBuilder::VisitDeclStmt().
Context clang::threadSafety::LocalVariableMap::addReference | ( | const NamedDecl * | D, |
unsigned | i, | ||
Context | Ctx | ||
) | [inline, protected] |
Definition at line 443 of file ThreadSafety.cpp.
Referenced by createReferenceContext().
Context clang::threadSafety::LocalVariableMap::clearDefinition | ( | const NamedDecl * | D, |
Context | Ctx | ||
) | [inline, protected] |
Definition at line 465 of file ThreadSafety.cpp.
Referenced by intersectContexts(), and clang::threadSafety::VarMapBuilder::VisitBinaryOperator().
LocalVariableMap::Context clang::threadSafety::LocalVariableMap::createReferenceContext | ( | Context | C | ) | [protected] |
Definition at line 573 of file ThreadSafety.cpp.
References addReference(), getEmptyContext(), and P.
Referenced by traverseCFG().
void clang::threadSafety::LocalVariableMap::dump | ( | ) | [inline] |
Dumps an ASCII representation of the variable map to llvm::errs()
Definition at line 392 of file ThreadSafety.cpp.
References clang::Stmt::dump(), and dumpVarDefinitionName().
void clang::threadSafety::LocalVariableMap::dumpContext | ( | Context | C | ) | [inline] |
Dumps an ASCII representation of a Context to llvm::errs()
Definition at line 408 of file ThreadSafety.cpp.
References dumpVarDefinitionName(), and clang::NamedDecl::printName().
void clang::threadSafety::LocalVariableMap::dumpVarDefinitionName | ( | unsigned | i | ) | [inline] |
Definition at line 377 of file ThreadSafety.cpp.
References clang::NamedDecl::printName().
Referenced by dump(), and dumpContext().
unsigned clang::threadSafety::LocalVariableMap::getContextIndex | ( | ) | [inline, protected] |
Definition at line 425 of file ThreadSafety.cpp.
Referenced by traverseCFG().
Definition at line 363 of file ThreadSafety.cpp.
Referenced by createReferenceContext(), clang::threadSafety::CFGBlockInfo::getEmptyBlockInfo(), and LocalVariableMap().
Context clang::threadSafety::LocalVariableMap::getNextContext | ( | unsigned & | CtxIndex, |
Stmt * | S, | ||
Context | C | ||
) | [inline] |
Return the next context after processing S. This function is used by clients of the class to get the appropriate context when traversing the CFG. It must be called for every assignment or DeclStmt.
Definition at line 368 of file ThreadSafety.cpp.
References AttributeLangSupport::C.
Referenced by clang::threadSafety::BuildLockset::VisitBinaryOperator(), and clang::threadSafety::BuildLockset::VisitDeclStmt().
void clang::threadSafety::LocalVariableMap::intersectBackEdge | ( | Context | C1, |
Context | C2 | ||
) | [protected] |
Definition at line 583 of file ThreadSafety.cpp.
References clang::threadSafety::LocalVariableMap::VarDefinition::isReference(), P, and clang::threadSafety::LocalVariableMap::VarDefinition::Ref.
Referenced by traverseCFG().
LocalVariableMap::Context clang::threadSafety::LocalVariableMap::intersectContexts | ( | Context | C1, |
Context | C2 | ||
) | [protected] |
Definition at line 557 of file ThreadSafety.cpp.
References clearDefinition(), P, and removeDefinition().
Referenced by traverseCFG().
const VarDefinition* clang::threadSafety::LocalVariableMap::lookup | ( | const NamedDecl * | D, |
Context | Ctx | ||
) | [inline] |
Look up a definition, within the given context.
Definition at line 336 of file ThreadSafety.cpp.
const Expr* clang::threadSafety::LocalVariableMap::lookupExpr | ( | const NamedDecl * | D, |
Context & | Ctx | ||
) | [inline] |
Look up the definition for D within the given context. Returns NULL if the expression is not statically known. If successful, also modifies Ctx to hold the context of the return Expr.
Definition at line 347 of file ThreadSafety.cpp.
References P.
Referenced by clang::threadSafety::ThreadSafetyAnalyzer::getTrylockCallExpr().
Context clang::threadSafety::LocalVariableMap::removeDefinition | ( | const NamedDecl * | D, |
Context | Ctx | ||
) | [inline, protected] |
Definition at line 475 of file ThreadSafety.cpp.
Referenced by intersectContexts().
void clang::threadSafety::LocalVariableMap::saveContext | ( | Stmt * | S, |
Context | C | ||
) | [inline, protected] |
Definition at line 428 of file ThreadSafety.cpp.
Referenced by traverseCFG(), clang::threadSafety::VarMapBuilder::VisitBinaryOperator(), and clang::threadSafety::VarMapBuilder::VisitDeclStmt().
void clang::threadSafety::LocalVariableMap::traverseCFG | ( | CFG * | CFGraph, |
const PostOrderCFGView * | SortedGraph, | ||
std::vector< CFGBlockInfo > & | BlockInfo | ||
) |
Builds the variable map.
Definition at line 634 of file ThreadSafety.cpp.
References clang::PostOrderCFGView::CFGBlockSet::alreadySet(), clang::CFGElement::castAs(), createReferenceContext(), clang::threadSafety::VarMapBuilder::Ctx, clang::threadSafety::CFGBlockInfo::EntryContext, clang::threadSafety::CFGBlockInfo::EntryIndex, clang::threadSafety::CFGBlockInfo::ExitContext, clang::CFGBlock::getBlockID(), getContextIndex(), clang::CFG::getExit(), clang::CFG::getNumBlockIDs(), clang::CFGStmt::getStmt(), clang::PostOrderCFGView::CFGBlockSet::insert(), intersectBackEdge(), intersectContexts(), saveContext(), clang::CFGElement::Statement, and clang::StmtVisitorBase< Ptr, ImplClass, RetTy >::Visit().
Referenced by clang::threadSafety::ThreadSafetyAnalyzer::runAnalysis().
Context clang::threadSafety::LocalVariableMap::updateDefinition | ( | const NamedDecl * | D, |
Expr * | Exp, | ||
Context | Ctx | ||
) | [inline, protected] |
Definition at line 452 of file ThreadSafety.cpp.
Referenced by clang::threadSafety::VarMapBuilder::VisitBinaryOperator().
friend class VarMapBuilder [friend] |
Definition at line 487 of file ThreadSafety.cpp.