Coverage Report

Created: 2019-03-22 08:08

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeMap.h
Line
Count
Source
1
//===- DynamicTypeMap.h - Dynamic type map ----------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
//  This file provides APIs for tracking dynamic type information.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICTYPEMAP_H
14
#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICTYPEMAP_H
15
16
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeInfo.h"
17
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
18
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
19
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
20
#include "llvm/ADT/ImmutableMap.h"
21
#include "clang/AST/Type.h"
22
23
namespace clang {
24
namespace ento {
25
26
class MemRegion;
27
28
/// The GDM component containing the dynamic type info. This is a map from a
29
/// symbol to its most likely type.
30
struct DynamicTypeMap {};
31
32
using DynamicTypeMapImpl =
33
    llvm::ImmutableMap<const MemRegion *, DynamicTypeInfo>;
34
35
template <>
36
struct ProgramStateTrait<DynamicTypeMap>
37
    : public ProgramStatePartialTrait<DynamicTypeMapImpl> {
38
  static void *GDMIndex();
39
};
40
41
/// Get dynamic type information for a region.
42
DynamicTypeInfo getDynamicTypeInfo(ProgramStateRef State,
43
                                   const MemRegion *Reg);
44
45
/// Set dynamic type information of the region; return the new state.
46
ProgramStateRef setDynamicTypeInfo(ProgramStateRef State, const MemRegion *Reg,
47
                                   DynamicTypeInfo NewTy);
48
49
/// Set dynamic type information of the region; return the new state.
50
inline ProgramStateRef setDynamicTypeInfo(ProgramStateRef State,
51
                                          const MemRegion *Reg, QualType NewTy,
52
2.84k
                                          bool CanBeSubClassed = true) {
53
2.84k
  return setDynamicTypeInfo(State, Reg,
54
2.84k
                            DynamicTypeInfo(NewTy, CanBeSubClassed));
55
2.84k
}
56
57
void printDynamicTypeInfo(ProgramStateRef State, raw_ostream &Out,
58
                          const char *NL, const char *Sep);
59
60
} // namespace ento
61
} // namespace clang
62
63
#endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICTYPEMAP_H