clang API Documentation
Handler class for thread safety warnings. More...
#include <ThreadSafety.h>
Public Types | |
| typedef llvm::StringRef | Name |
Public Member Functions | |
| virtual | ~ThreadSafetyHandler () |
| virtual void | handleInvalidLockExp (SourceLocation Loc) |
| virtual void | handleUnmatchedUnlock (Name LockName, SourceLocation Loc) |
| virtual void | handleDoubleLock (Name LockName, SourceLocation Loc) |
| virtual void | handleMutexHeldEndOfScope (Name LockName, SourceLocation LocLocked, SourceLocation LocEndOfScope, LockErrorKind LEK) |
| virtual void | handleExclusiveAndShared (Name LockName, SourceLocation Loc1, SourceLocation Loc2) |
| virtual void | handleNoMutexHeld (const NamedDecl *D, ProtectedOperationKind POK, AccessKind AK, SourceLocation Loc) |
| virtual void | handleMutexNotHeld (const NamedDecl *D, ProtectedOperationKind POK, Name LockName, LockKind LK, SourceLocation Loc) |
| virtual void | handleFunExcludesLock (Name FunName, Name LockName, SourceLocation Loc) |
Handler class for thread safety warnings.
Definition at line 67 of file ThreadSafety.h.
| typedef llvm::StringRef clang::thread_safety::ThreadSafetyHandler::Name |
Definition at line 69 of file ThreadSafety.h.
| ThreadSafetyHandler::~ThreadSafetyHandler | ( | ) | [virtual] |
Definition at line 44 of file ThreadSafety.cpp.
| virtual void clang::thread_safety::ThreadSafetyHandler::handleDoubleLock | ( | Name | LockName, |
| SourceLocation | Loc | ||
| ) | [inline, virtual] |
Warn about lock function calls for locks which are already held.
| LockName | -- A StringRef name for the lock expression, to be printed in the error message. |
| Loc | -- The location of the second lock expression. |
Definition at line 87 of file ThreadSafety.h.
| virtual void clang::thread_safety::ThreadSafetyHandler::handleExclusiveAndShared | ( | Name | LockName, |
| SourceLocation | Loc1, | ||
| SourceLocation | Loc2 | ||
| ) | [inline, virtual] |
Warn when a mutex is held exclusively and shared at the same point. For example, if a mutex is locked exclusively during an if branch and shared during the else branch.
| LockName | -- A StringRef name for the lock expression, to be printed in the error message. |
| Loc1 | -- The location of the first lock expression. |
| Loc2 | -- The location of the second lock expression. |
Definition at line 113 of file ThreadSafety.h.
| virtual void clang::thread_safety::ThreadSafetyHandler::handleFunExcludesLock | ( | Name | FunName, |
| Name | LockName, | ||
| SourceLocation | Loc | ||
| ) | [inline, virtual] |
Warn when a function is called while an excluded mutex is locked. For example, the mutex may be locked inside the function.
| FunName | -- The name of the function |
| LockName | -- A StringRef name for the lock expression, to be printed in the error message. |
| Loc | -- The location of the function call. |
Definition at line 142 of file ThreadSafety.h.
| virtual void clang::thread_safety::ThreadSafetyHandler::handleInvalidLockExp | ( | SourceLocation | Loc | ) | [inline, virtual] |
Warn about lock expressions which fail to resolve to lockable objects.
| Loc | -- the SourceLocation of the unresolved expression. |
Definition at line 74 of file ThreadSafety.h.
| virtual void clang::thread_safety::ThreadSafetyHandler::handleMutexHeldEndOfScope | ( | Name | LockName, |
| SourceLocation | LocLocked, | ||
| SourceLocation | LocEndOfScope, | ||
| LockErrorKind | LEK | ||
| ) | [inline, virtual] |
Warn about situations where a mutex is sometimes held and sometimes not. The three situations are: 1. a mutex is locked on an "if" branch but not the "else" branch, 2, or a mutex is only held at the start of some loop iterations, 3. or when a mutex is locked but not unlocked inside a function.
| LockName | -- A StringRef name for the lock expression, to be printed in the error message. |
| LocLocked | -- The location of the lock expression where the mutex is locked |
| LocEndOfScope | -- The location of the end of the scope where the mutex is no longer held |
| LEK | -- which of the three above cases we should warn for |
Definition at line 101 of file ThreadSafety.h.
| virtual void clang::thread_safety::ThreadSafetyHandler::handleMutexNotHeld | ( | const NamedDecl * | D, |
| ProtectedOperationKind | POK, | ||
| Name | LockName, | ||
| LockKind | LK, | ||
| SourceLocation | Loc | ||
| ) | [inline, virtual] |
Warn when a protected operation occurs while the specific mutex protecting the operation is not locked.
| LockName | -- A StringRef name for the lock expression, to be printed in the error message. |
| D | -- The decl for the protected variable or function |
| POK | -- The kind of protected operation (e.g. variable access) |
| AK | -- The kind of access (i.e. read or write) that occurred |
| Loc | -- The location of the protected operation. |
Definition at line 132 of file ThreadSafety.h.
| virtual void clang::thread_safety::ThreadSafetyHandler::handleNoMutexHeld | ( | const NamedDecl * | D, |
| ProtectedOperationKind | POK, | ||
| AccessKind | AK, | ||
| SourceLocation | Loc | ||
| ) | [inline, virtual] |
Warn when a protected operation occurs while no locks are held.
| D | -- The decl for the protected variable or function |
| POK | -- The kind of protected operation (e.g. variable access) |
| AK | -- The kind of access (i.e. read or write) that occurred |
| Loc | -- The location of the protected operation. |
Definition at line 121 of file ThreadSafety.h.
| virtual void clang::thread_safety::ThreadSafetyHandler::handleUnmatchedUnlock | ( | Name | LockName, |
| SourceLocation | Loc | ||
| ) | [inline, virtual] |
Warn about unlock function calls that do not have a prior matching lock expression.
| LockName | -- A StringRef name for the lock expression, to be printed in the error message. |
| Loc | -- The SourceLocation of the Unlock |
Definition at line 81 of file ThreadSafety.h.