clang API Documentation

Classes | Namespaces | Typedefs | Enumerations | Functions
ThreadSafety.cpp File Reference
#include "clang/AST/Attr.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Analysis/Analyses/PostOrderCFGView.h"
#include "clang/Analysis/Analyses/ThreadSafety.h"
#include "clang/Analysis/Analyses/ThreadSafetyLogical.h"
#include "clang/Analysis/Analyses/ThreadSafetyTIL.h"
#include "clang/Analysis/Analyses/ThreadSafetyTraverse.h"
#include "clang/Analysis/Analyses/ThreadSafetyCommon.h"
#include "clang/Analysis/AnalysisContext.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/CFGStmtMap.h"
#include "clang/Basic/OperatorKinds.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/ImmutableMap.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <ostream>
#include <sstream>
#include <utility>
#include <vector>
Include dependency graph for ThreadSafety.cpp:

Go to the source code of this file.

Classes

class  clang::threadSafety::TILPrinter
class  clang::threadSafety::CapExprSet
 A set of CapabilityInfo objects, which are compiled from the requires attributes on a function. More...
class  clang::threadSafety::FactEntry
 This is a helper class that stores a fact that is known at a particular point in program execution. Currently, a fact is a capability, along with additional information, such as where it was acquired, whether it is exclusive or shared, etc. More...
class  clang::threadSafety::FactManager
 FactManager manages the memory for all facts that are created during the analysis of a single routine. More...
class  clang::threadSafety::FactSet
 A FactSet is the set of facts that are known to be true at a particular program point. FactSets must be small, because they are frequently copied, and are thus implemented as a set of indices into a table maintained by a FactManager. A typical FactSet only holds 1 or 2 locks, so we can get away with doing a linear search for lookup. Note that a hashtable or map is inappropriate in this case, because lookups may involve partial pattern matches, rather than exact matches. More...
struct  clang::threadSafety::CFGBlockInfo
class  clang::threadSafety::LocalVariableMap
struct  clang::threadSafety::LocalVariableMap::VarDefinition
class  clang::threadSafety::VarMapBuilder
 Visitor which builds a LocalVariableMap. More...
class  clang::threadSafety::LockableFactEntry
class  clang::threadSafety::ScopedLockableFactEntry
class  clang::threadSafety::ThreadSafetyAnalyzer
 Class which implements the core thread safety analysis routines. More...
class  clang::threadSafety::has_arg_iterator_range< Ty >
class  clang::threadSafety::BuildLockset
 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...

Namespaces

namespace  clang
namespace  clang::threadSafety

Typedefs

typedef unsigned short clang::threadSafety::FactID
typedef llvm::ImmutableMap
< const NamedDecl *, unsigned
clang::threadSafety::LocalVarContext

Enumerations

enum  clang::threadSafety::CFGBlockSide { clang::threadSafety::CBS_Entry, clang::threadSafety::CBS_Exit }
 A side (entry or exit) of a CFG node. More...

Functions

static void clang::threadSafety::warnInvalidLock (ThreadSafetyHandler &Handler, const Expr *MutexExp, const NamedDecl *D, const Expr *DeclExp, StringRef Kind)
 Issue a warning about an invalid lock expression.
static void clang::threadSafety::findBlockLocations (CFG *CFGraph, const PostOrderCFGView *SortedGraph, std::vector< CFGBlockInfo > &BlockInfo)
static const ValueDecl * clang::threadSafety::getValueDecl (const Expr *Exp)
 Gets the value decl pointer from DeclRefExprs or MemberExprs.
static StringRef clang::threadSafety::ClassifyDiagnostic (const CapabilityAttr *A)
static StringRef clang::threadSafety::ClassifyDiagnostic (QualType VDT)
static StringRef clang::threadSafety::ClassifyDiagnostic (const ValueDecl *VD)
template<typename AttrTy >
static std::enable_if
<!has_arg_iterator_range
< AttrTy >::value, StringRef >
::type 
clang::threadSafety::ClassifyDiagnostic (const AttrTy *A)
bool clang::threadSafety::getStaticBooleanValue (Expr *E, bool &TCond)
bool clang::threadSafety::neverReturns (const CFGBlock *B)
void clang::threadSafety::runThreadSafetyAnalysis (AnalysisDeclContext &AC, ThreadSafetyHandler &Handler)
 Check a function's CFG for thread-safety violations.
LockKind clang::threadSafety::getLockKindFromAccessKind (AccessKind AK)
 Helper function that returns a LockKind required for the given level of access.