19 #ifndef LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETY_H
20 #define LLVM_CLANG_ANALYSIS_ANALYSES_THREADSAFETY_H
24 #include "llvm/ADT/StringRef.h"
27 namespace threadSafety {
166 Name *PossibleMatch =
nullptr) {}
207 bool IssueBetaWarnings;
216 ThreadSafetyHandler &Handler,
virtual void handleNoMutexHeld(StringRef Kind, const NamedDecl *D, ProtectedOperationKind POK, AccessKind AK, SourceLocation Loc)
Passing a guarded variable by reference.
virtual void handleUnmatchedUnlock(StringRef Kind, Name LockName, SourceLocation Loc)
LockKind getLockKindFromAccessKind(AccessKind AK)
Helper function that returns a LockKind required for the given level of access.
Exclusive/writer lock of a mutex.
void threadSafetyCleanup(BeforeSet *Cache)
virtual void enterFunction(const FunctionDecl *FD)
virtual void handleInvalidLockExp(StringRef Kind, SourceLocation Loc)
virtual void handleNegativeNotHeld(StringRef Kind, Name LockName, Name Neg, SourceLocation Loc)
Shared/reader lock of a mutex.
virtual ~ThreadSafetyHandler()
Passing a pt-guarded variable by reference.
Handler class for thread safety warnings.
Dereferencing a variable (e.g. p in *p = 5;)
virtual void handleLockAcquiredBefore(StringRef Kind, Name L1Name, Name L2Name, SourceLocation Loc)
Warn that L1 cannot be acquired before L2.
virtual void handleIncorrectUnlockKind(StringRef Kind, Name LockName, LockKind Expected, LockKind Received, SourceLocation Loc)
virtual void handleFunExcludesLock(StringRef Kind, Name FunName, Name LockName, SourceLocation Loc)
Making a function call (e.g. fool())
Reading or writing a variable (e.g. x in x = 5;)
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
virtual void handleBeforeAfterCycle(Name L1Name, SourceLocation Loc)
Warn that there is a cycle in acquired_before/after dependencies.
virtual void handleMutexNotHeld(StringRef Kind, const NamedDecl *D, ProtectedOperationKind POK, Name LockName, LockKind LK, SourceLocation Loc, Name *PossibleMatch=nullptr)
void runThreadSafetyAnalysis(AnalysisDeclContext &AC, ThreadSafetyHandler &Handler, BeforeSet **Bset)
Check a function's CFG for thread-safety violations.
virtual void handleExclusiveAndShared(StringRef Kind, Name LockName, SourceLocation Loc1, SourceLocation Loc2)
virtual void handleDoubleLock(StringRef Kind, Name LockName, SourceLocation Loc)
Defines the clang::SourceLocation class and associated facilities.
virtual void handleMutexHeldEndOfScope(StringRef Kind, Name LockName, SourceLocation LocLocked, SourceLocation LocEndOfScope, LockErrorKind LEK)
void setIssueBetaWarnings(bool b)
virtual void leaveFunction(const FunctionDecl *FD)
Called by the analysis when finishing analysis of a function.
Can be either Shared or Exclusive.