Coverage Report

Created: 2017-10-03 07:32

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeInfo.h
Line
Count
Source
1
//== DynamicTypeInfo.h - Runtime type information ----------------*- 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
#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICTYPEINFO_H
10
#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICTYPEINFO_H
11
12
#include "clang/AST/Type.h"
13
14
namespace clang {
15
namespace ento {
16
17
/// \brief Stores the currently inferred strictest bound on the runtime type
18
/// of a region in a given state along the analysis path.
19
class DynamicTypeInfo {
20
private:
21
  QualType T;
22
  bool CanBeASubClass;
23
24
public:
25
26
1
  DynamicTypeInfo() : T(QualType()) {}
27
  DynamicTypeInfo(QualType WithType, bool CanBeSub = true)
28
5.64k
    : T(WithType), CanBeASubClass(CanBeSub) {}
29
30
  /// \brief Return false if no dynamic type info is available.
31
5.24k
  bool isValid() const { return !T.isNull(); }
32
33
  /// \brief Returns the currently inferred upper bound on the runtime type.
34
6.11k
  QualType getType() const { return T; }
35
36
  /// \brief Returns false if the type information is precise (the type T is
37
  /// the only type in the lattice), true otherwise.
38
2.39k
  bool canBeASubClass() const { return CanBeASubClass; }
39
40
3.17k
  void Profile(llvm::FoldingSetNodeID &ID) const {
41
3.17k
    ID.Add(T);
42
3.17k
    ID.AddInteger((unsigned)CanBeASubClass);
43
3.17k
  }
44
378
  bool operator==(const DynamicTypeInfo &X) const {
45
378
    return T == X.T && CanBeASubClass == X.CanBeASubClass;
46
378
  }
47
};
48
49
} // end ento
50
} // end clang
51
52
#endif