clang API Documentation
Classes | |
| class | ThreadSafetyHandler |
| Handler class for thread safety warnings. More... | |
| struct | SortDiagBySourceLocation |
Typedefs | |
| typedef llvm::SmallVector < PartialDiagnosticAt, 1 > | OptionalNotes |
| typedef std::pair < PartialDiagnosticAt, OptionalNotes > | DelayedDiag |
| typedef std::list< DelayedDiag > | DiagList |
Enumerations | |
| enum | ProtectedOperationKind { POK_VarDereference, POK_VarAccess, POK_FunctionCall } |
| enum | LockKind { LK_Shared, LK_Exclusive } |
| enum | AccessKind { AK_Read, AK_Written } |
| enum | LockErrorKind { LEK_LockedSomeLoopIterations, LEK_LockedSomePredecessors, LEK_LockedAtEndOfFunction } |
Functions | |
| void | runThreadSafetyAnalysis (AnalysisDeclContext &AC, ThreadSafetyHandler &Handler) |
| Check a function's CFG for thread-safety violations. | |
| LockKind | getLockKindFromAccessKind (AccessKind AK) |
| Helper function that returns a LockKind required for the given level of access. | |
| typedef std::pair<PartialDiagnosticAt, OptionalNotes> clang::thread_safety::DelayedDiag |
Definition at line 806 of file AnalysisBasedWarnings.cpp.
| typedef std::list<DelayedDiag> clang::thread_safety::DiagList |
Definition at line 807 of file AnalysisBasedWarnings.cpp.
| typedef llvm::SmallVector<PartialDiagnosticAt, 1> clang::thread_safety::OptionalNotes |
Definition at line 805 of file AnalysisBasedWarnings.cpp.
This enum distinguishes between different ways to access (read or write) a variable.
Definition at line 47 of file ThreadSafety.h.
Definition at line 60 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.
Definition at line 40 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.
| POK_VarDereference | |
| POK_VarAccess |
Dereferencing a variable (e.g. p in *p = 5;) |
| POK_FunctionCall |
Reading or writing a variable (e.g. x in x = 5;) Making a function call (e.g. fool()) |
Definition at line 31 of file ThreadSafety.h.
| LockKind clang::thread_safety::getLockKindFromAccessKind | ( | AccessKind | AK | ) |
Helper function that returns a LockKind required for the given level of access.
Definition at line 1762 of file ThreadSafety.cpp.
References AK_Read, AK_Written, LK_Exclusive, and LK_Shared.
| void clang::thread_safety::runThreadSafetyAnalysis | ( | AnalysisDeclContext & | AC, |
| ThreadSafetyHandler & | Handler | ||
| ) |
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 1754 of file ThreadSafety.cpp.
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().