clang
8.0.0
|
Namespaces | |
lexpr | |
sx | |
til | |
Classes | |
class | BeforeSet |
class | CapabilityExpr |
class | CFGVisitor |
class | CFGWalker |
class | CopyOnWriteVector |
class | SExprBuilder |
class | ThreadSafetyHandler |
Handler class for thread safety warnings. More... | |
Enumerations | |
enum | ProtectedOperationKind { POK_VarDereference, POK_VarAccess, POK_FunctionCall, POK_PassByRef, POK_PtPassByRef } |
This enum distinguishes between different kinds of operations that may need to be protected by locks. More... | |
enum | LockKind { LK_Shared, LK_Exclusive, LK_Generic } |
This enum distinguishes between different kinds of lock actions. More... | |
enum | AccessKind { AK_Read, AK_Written } |
This enum distinguishes between different ways to access (read or write) a variable. More... | |
enum | LockErrorKind { LEK_LockedSomeLoopIterations, LEK_LockedSomePredecessors, LEK_LockedAtEndOfFunction, LEK_NotLockedAtEndOfFunction } |
Functions | |
void | runThreadSafetyAnalysis (AnalysisDeclContext &AC, ThreadSafetyHandler &Handler, BeforeSet **Bset) |
Check a function's CFG for thread-safety violations. More... | |
void | threadSafetyCleanup (BeforeSet *Cache) |
LockKind | getLockKindFromAccessKind (AccessKind AK) |
Helper function that returns a LockKind required for the given level of access. More... | |
void | printSCFG (CFGWalker &Walker) |
std::string | getSourceLiteralString (const Expr *CE) |
std::ostream & | operator<< (std::ostream &ss, const StringRef str) |
This enum distinguishes between different ways to access (read or write) a variable.
Enumerator | |
---|---|
AK_Read | Reading a variable. |
AK_Written | Writing a variable. |
Definition at line 70 of file ThreadSafety.h.
Enumerator | |
---|---|
LEK_LockedSomeLoopIterations | |
LEK_LockedSomePredecessors | |
LEK_LockedAtEndOfFunction | |
LEK_NotLockedAtEndOfFunction |
Definition at line 86 of file ThreadSafety.h.
This enum distinguishes between different kinds of lock actions.
For example, it is an error to write a variable protected by shared version of a mutex.
Enumerator | |
---|---|
LK_Shared | Shared/reader lock of a mutex. |
LK_Exclusive | Exclusive/writer lock of a mutex. |
LK_Generic | Can be either Shared or Exclusive. |
Definition at line 57 of file ThreadSafety.h.
This enum distinguishes between different kinds of operations that may need to be protected by locks.
We use this enum in error handling.
Definition at line 37 of file ThreadSafety.h.
LockKind clang::threadSafety::getLockKindFromAccessKind | ( | AccessKind | AK | ) |
Helper function that returns a LockKind required for the given level of access.
Definition at line 2562 of file ThreadSafety.cpp.
References AK_Read, AK_Written, LK_Exclusive, and LK_Shared.
Referenced by getStaticBooleanValue(), and clang::threadSafety::ThreadSafetyHandler::setIssueBetaWarnings().
std::string clang::threadSafety::getSourceLiteralString | ( | const Expr * | CE | ) |
Definition at line 41 of file ThreadSafetyCommon.cpp.
References clang::Stmt::getStmtClass(), and getValue().
Referenced by operator new(), and clang::threadSafety::til::PrettyPrinter< StdPrinter, std::ostream >::printLiteral().
|
inline |
Definition at line 351 of file ThreadSafetyUtil.h.
void clang::threadSafety::printSCFG | ( | CFGWalker & | Walker | ) |
void clang::threadSafety::runThreadSafetyAnalysis | ( | AnalysisDeclContext & | AC, |
ThreadSafetyHandler & | Handler, | ||
BeforeSet ** | BSet | ||
) |
Check a function's CFG for thread-safety violations.
We traverse the blocks in the CFG, compute the set of mutexes that are held at the end of each block, and issue warnings for thread safety violations. Each block in the CFG is traversed exactly once.
Definition at line 2549 of file ThreadSafety.cpp.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings(), and clang::threadSafety::ThreadSafetyHandler::setIssueBetaWarnings().
void clang::threadSafety::threadSafetyCleanup | ( | BeforeSet * | Cache | ) |
Definition at line 2558 of file ThreadSafety.cpp.
Referenced by clang::threadSafety::ThreadSafetyHandler::setIssueBetaWarnings(), and clang::Sema::~Sema().