clang  8.0.0svn
Classes | Namespaces | Macros
ProgramStateTrait.h File Reference
#include "llvm/ADT/ImmutableList.h"
#include "llvm/ADT/ImmutableMap.h"
#include "llvm/ADT/ImmutableSet.h"
#include "llvm/Support/Allocator.h"
#include <cstdint>
Include dependency graph for ProgramStateTrait.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  clang::ento::ProgramStatePartialTrait< T >
 
struct  clang::ento::ProgramStatePartialTrait< llvm::ImmutableMap< Key, Data, Info > >
 
struct  clang::ento::ProgramStatePartialTrait< llvm::ImmutableSet< Key, Info > >
 
struct  clang::ento::ProgramStatePartialTrait< llvm::ImmutableList< T > >
 
struct  clang::ento::ProgramStatePartialTrait< bool >
 
struct  clang::ento::ProgramStatePartialTrait< unsigned >
 
struct  clang::ento::ProgramStatePartialTrait< void * >
 
struct  clang::ento::ProgramStatePartialTrait< const void * >
 

Namespaces

 clang
 Dataflow Directional Tag Classes.
 
 clang::ento
 

Macros

#define REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, Type)
 Declares a program state trait for type Type called Name, and introduce a type named NameTy. More...
 
#define REGISTER_FACTORY_WITH_PROGRAMSTATE(Type)
 Declares a factory for objects of type Type in the program state manager. More...
 
#define CLANG_ENTO_PROGRAMSTATE_MAP(Key, Value)   llvm::ImmutableMap<Key, Value>
 Helper for registering a map trait. More...
 
#define REGISTER_MAP_WITH_PROGRAMSTATE(Name, Key, Value)
 Declares an immutable map of type NameTy, suitable for placement into the ProgramState. More...
 
#define REGISTER_MAP_FACTORY_WITH_PROGRAMSTATE(Name, Key, Value)
 Declares an immutable map type Name and registers the factory for such maps in the program state, but does not add the map itself to the program state. More...
 
#define REGISTER_SET_WITH_PROGRAMSTATE(Name, Elem)   REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, llvm::ImmutableSet<Elem>)
 Declares an immutable set of type NameTy, suitable for placement into the ProgramState. More...
 
#define REGISTER_SET_FACTORY_WITH_PROGRAMSTATE(Name, Elem)
 Declares an immutable set type Name and registers the factory for such sets in the program state, but does not add the set itself to the program state. More...
 
#define REGISTER_LIST_WITH_PROGRAMSTATE(Name, Elem)   REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, llvm::ImmutableList<Elem>)
 Declares an immutable list type NameTy, suitable for placement into the ProgramState. More...
 
#define REGISTER_LIST_FACTORY_WITH_PROGRAMSTATE(Name, Elem)
 Declares an immutable list of type Name and registers the factory for such lists in the program state, but does not add the list itself to the program state. More...
 

Macro Definition Documentation

◆ CLANG_ENTO_PROGRAMSTATE_MAP

#define CLANG_ENTO_PROGRAMSTATE_MAP (   Key,
  Value 
)    llvm::ImmutableMap<Key, Value>

Helper for registering a map trait.

If the map type were written directly in the invocation of REGISTER_TRAIT_WITH_PROGRAMSTATE, the comma in the template arguments would be treated as a macro argument separator, which is wrong. This allows the user to specify a map type in a way that the preprocessor can deal with.

Definition at line 71 of file ProgramStateTrait.h.

◆ REGISTER_FACTORY_WITH_PROGRAMSTATE

#define REGISTER_FACTORY_WITH_PROGRAMSTATE (   Type)
Value:
namespace clang { \
namespace ento { \
template <> \
struct ProgramStateTrait<Type> \
: public ProgramStatePartialTrait<Type> { \
static void *GDMIndex() { static int Index; return &Index; } \
}; \
} \
}
Dataflow Directional Tag Classes.

Declares a factory for objects of type Type in the program state manager.

The type must provide a ::Factory sub-class. Commonly used for ImmutableMap, ImmutableSet, ImmutableList. The macro should not be used inside namespaces.

Definition at line 53 of file ProgramStateTrait.h.

◆ REGISTER_LIST_FACTORY_WITH_PROGRAMSTATE

#define REGISTER_LIST_FACTORY_WITH_PROGRAMSTATE (   Name,
  Elem 
)
Value:
using Name = llvm::ImmutableList<Elem>; \
REGISTER_FACTORY_WITH_PROGRAMSTATE(Name)

Declares an immutable list of type Name and registers the factory for such lists in the program state, but does not add the list itself to the program state.

Useful for managing lifetime of lists that are used as elements of other program state data structures.

Definition at line 140 of file ProgramStateTrait.h.

◆ REGISTER_LIST_WITH_PROGRAMSTATE

#define REGISTER_LIST_WITH_PROGRAMSTATE (   Name,
  Elem 
)    REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, llvm::ImmutableList<Elem>)

Declares an immutable list type NameTy, suitable for placement into the ProgramState.

This is implementing using llvm::ImmutableList.

State = State->add<Name>(E); // Adds to the /end/ of the list.
bool Present = State->contains<Name>(E);
NameTy List = State->get<Name>();

The macro should not be used inside namespaces, or for traits that must be accessible from more than one translation unit.

Definition at line 133 of file ProgramStateTrait.h.

Referenced by LoopState::Profile().

◆ REGISTER_MAP_FACTORY_WITH_PROGRAMSTATE

#define REGISTER_MAP_FACTORY_WITH_PROGRAMSTATE (   Name,
  Key,
  Value 
)
Value:
using Name = llvm::ImmutableMap<Key, Value>; \
REGISTER_FACTORY_WITH_PROGRAMSTATE(Name)

Declares an immutable map type Name and registers the factory for such maps in the program state, but does not add the map itself to the program state.

Useful for managing lifetime of maps that are used as elements of other program state data structures.

Definition at line 93 of file ProgramStateTrait.h.

◆ REGISTER_MAP_WITH_PROGRAMSTATE

#define REGISTER_MAP_WITH_PROGRAMSTATE (   Name,
  Key,
  Value 
)
Value:
#define REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, Type)
Declares a program state trait for type Type called Name, and introduce a type named NameTy...
#define CLANG_ENTO_PROGRAMSTATE_MAP(Key, Value)
Helper for registering a map trait.

Declares an immutable map of type NameTy, suitable for placement into the ProgramState.

This is implementing using llvm::ImmutableMap.

State = State->set<Name>(K, V);
const Value *V = State->get<Name>(K); // Returns NULL if not in the map.
State = State->remove<Name>(K);
NameTy Map = State->get<Name>();

The macro should not be used inside namespaces, or for traits that must be accessible from more than one translation unit.

Definition at line 85 of file ProgramStateTrait.h.

Referenced by isSynthesizedRetainableProperty(), llvm::FoldingSetTrait< ObjectState >::Profile(), and llvm::FoldingSetTrait< AllocKind >::Profile().

◆ REGISTER_SET_FACTORY_WITH_PROGRAMSTATE

#define REGISTER_SET_FACTORY_WITH_PROGRAMSTATE (   Name,
  Elem 
)
Value:
using Name = llvm::ImmutableSet<Elem>; \
REGISTER_FACTORY_WITH_PROGRAMSTATE(Name)

Declares an immutable set type Name and registers the factory for such sets in the program state, but does not add the set itself to the program state.

Useful for managing lifetime of sets that are used as elements of other program state data structures.

Definition at line 117 of file ProgramStateTrait.h.

Referenced by isSynthesizedRetainableProperty().

◆ REGISTER_SET_WITH_PROGRAMSTATE

#define REGISTER_SET_WITH_PROGRAMSTATE (   Name,
  Elem 
)    REGISTER_TRAIT_WITH_PROGRAMSTATE(Name, llvm::ImmutableSet<Elem>)

Declares an immutable set of type NameTy, suitable for placement into the ProgramState.

This is implementing using llvm::ImmutableSet.

State = State->add<Name>(E);
State = State->remove<Name>(E);
bool Present = State->contains<Name>(E);
NameTy Set = State->get<Name>();

The macro should not be used inside namespaces, or for traits that must be accessible from more than one translation unit.

Definition at line 110 of file ProgramStateTrait.h.

◆ REGISTER_TRAIT_WITH_PROGRAMSTATE

#define REGISTER_TRAIT_WITH_PROGRAMSTATE (   Name,
  Type 
)
Value:
namespace { \
class Name {}; \
using Name ## Ty = Type; \
} \
namespace clang { \
namespace ento { \
template <> \
struct ProgramStateTrait<Name> \
: public ProgramStatePartialTrait<Name ## Ty> { \
static void *GDMIndex() { static int Index; return &Index; } \
}; \
} \
}
Optional< types::ID > Type
Dataflow Directional Tag Classes.

Declares a program state trait for type Type called Name, and introduce a type named NameTy.

The macro should not be used inside namespaces.

Definition at line 34 of file ProgramStateTrait.h.