clang API Documentation
We use this class to visit different types of expressions in CFGBlocks, and build up the lockset. An expression may cause us to add or remove locks from the lockset, or else output error messages related to missing locks. FIXME: In future, we may be able to not inherit from a visitor. More...
Public Member Functions | |
BuildLockset (ThreadSafetyAnalyzer *Anlzr, CFGBlockInfo &Info) | |
void | VisitUnaryOperator (UnaryOperator *UO) |
For unary operations which read and write a variable, we need to check whether we hold any required mutexes. Reads are checked in VisitCastExpr. | |
void | VisitBinaryOperator (BinaryOperator *BO) |
void | VisitCastExpr (CastExpr *CE) |
void | VisitCallExpr (CallExpr *Exp) |
void | VisitCXXConstructExpr (CXXConstructExpr *Exp) |
void | VisitDeclStmt (DeclStmt *S) |
Friends | |
class | ThreadSafetyAnalyzer |
We use this class to visit different types of expressions in CFGBlocks, and build up the lockset. An expression may cause us to add or remove locks from the lockset, or else output error messages related to missing locks. FIXME: In future, we may be able to not inherit from a visitor.
Definition at line 1273 of file ThreadSafety.cpp.
clang::threadSafety::BuildLockset::BuildLockset | ( | ThreadSafetyAnalyzer * | Anlzr, |
CFGBlockInfo & | Info | ||
) | [inline] |
Definition at line 1296 of file ThreadSafety.cpp.
For binary operations which assign to a variable (writes), we need to check whether we hold any required mutexes. FIXME: Deal with non-primitive types.
Definition at line 1655 of file ThreadSafety.cpp.
References clang::threadSafety::AK_Written, clang::BinaryOperator::getLHS(), clang::threadSafety::LocalVariableMap::getNextContext(), and clang::BinaryOperator::isAssignmentOp().
void clang::threadSafety::BuildLockset::VisitCallExpr | ( | CallExpr * | Exp | ) |
Definition at line 1676 of file ThreadSafety.cpp.
References clang::threadSafety::AK_Read, clang::threadSafety::AK_Written, clang::CallExpr::getArg(), clang::CallExpr::getCalleeDecl(), clang::CallExpr::getDirectCallee(), clang::CallExpr::getNumArgs(), clang::ValueDecl::getType(), clang::Decl::hasAttrs(), clang::MemberExpr::isArrow(), clang::Type::isReferenceType(), and clang::threadSafety::POK_PassByRef.
void clang::threadSafety::BuildLockset::VisitCastExpr | ( | CastExpr * | CE | ) |
Whenever we do an LValue to Rvalue cast, we are reading a variable and need to ensure we hold any required mutexes. FIXME: Deal with non-primitive types.
Definition at line 1669 of file ThreadSafety.cpp.
References clang::threadSafety::AK_Read, clang::CK_LValueToRValue, clang::CastExpr::getCastKind(), and clang::CastExpr::getSubExpr().
Definition at line 1770 of file ThreadSafety.cpp.
References clang::threadSafety::AK_Read, clang::CXXConstructExpr::getArg(), clang::CXXConstructExpr::getConstructor(), and clang::CXXConstructorDecl::isCopyConstructor().
Definition at line 1779 of file ThreadSafety.cpp.
References clang::DeclStmt::getDeclGroup(), clang::threadSafety::LocalVariableMap::getNextContext(), and clang::Decl::hasAttrs().
For unary operations which read and write a variable, we need to check whether we hold any required mutexes. Reads are checked in VisitCastExpr.
Definition at line 1638 of file ThreadSafety.cpp.
References clang::threadSafety::AK_Written, clang::UnaryOperator::getOpcode(), clang::UnaryOperator::getSubExpr(), clang::UO_PostDec, clang::UO_PostInc, clang::UO_PreDec, and clang::UO_PreInc.
friend class ThreadSafetyAnalyzer [friend] |
Definition at line 1274 of file ThreadSafety.cpp.