clang  6.0.0svn
DynamicTypeMap.h
Go to the documentation of this file.
1 //== DynamicTypeMap.h - Dynamic type map ----------------------- -*- C++ -*--=//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides APIs for tracking dynamic type information.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICTYPEMAP_H
15 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICTYPEMAP_H
19 #include "llvm/ADT/ImmutableMap.h"
20 
21 namespace clang {
22 namespace ento {
23 
24 /// The GDM component containing the dynamic type info. This is a map from a
25 /// symbol to its most likely type.
26 struct DynamicTypeMap {};
29 template <>
31  : public ProgramStatePartialTrait<DynamicTypeMapImpl> {
32  static void *GDMIndex() {
33  static int index = 0;
34  return &index;
35  }
36 };
37 
38 /// \brief Get dynamic type information for a region.
40  const MemRegion *Reg);
41 
42 /// \brief Set dynamic type information of the region; return the new state.
44  DynamicTypeInfo NewTy);
45 
46 /// \brief Set dynamic type information of the region; return the new state.
48  const MemRegion *Reg, QualType NewTy,
49  bool CanBeSubClassed = true) {
50  return setDynamicTypeInfo(State, Reg,
51  DynamicTypeInfo(NewTy, CanBeSubClassed));
52 }
53 
54 } // ento
55 } // clang
56 
57 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICTYPEMAP_H
A (possibly-)qualified type.
Definition: Type.h:653
MemRegion - The root abstract class for all memory regions.
Definition: MemRegion.h:79
The GDM component containing the dynamic type info.
LineState State
llvm::ImmutableMap< const MemRegion *, DynamicTypeInfo > DynamicTypeMapImpl
Stores the currently inferred strictest bound on the runtime type of a region in a given state along ...
ProgramStateRef setDynamicTypeInfo(ProgramStateRef State, const MemRegion *Reg, DynamicTypeInfo NewTy)
Set dynamic type information of the region; return the new state.
Dataflow Directional Tag Classes.
DynamicTypeInfo getDynamicTypeInfo(ProgramStateRef State, const MemRegion *Reg)
Get dynamic type information for a region.