Coverage Report

Created: 2018-11-16 02:38

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerHelpers.h
Line
Count
Source (jump to first uncovered line)
1
//== CheckerHelpers.h - Helper functions for checkers ------------*- 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 defines CheckerVisitor.
11
//
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H
15
#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CHECKERHELPERS_H
16
17
#include "clang/AST/Stmt.h"
18
#include <tuple>
19
20
namespace clang {
21
22
class Expr;
23
class VarDecl;
24
class QualType;
25
class AttributedType;
26
27
namespace ento {
28
29
bool containsMacro(const Stmt *S);
30
bool containsEnum(const Stmt *S);
31
bool containsStaticLocal(const Stmt *S);
32
bool containsBuiltinOffsetOf(const Stmt *S);
33
40
template <class T> bool containsStmt(const Stmt *S) {
34
40
  if (isa<T>(S))
35
1
      return true;
36
39
37
39
  for (const Stmt *Child : S->children())
38
30
    if (Child && containsStmt<T>(Child))
39
0
      return true;
40
39
41
39
  return false;
42
39
}
43
44
std::pair<const clang::VarDecl *, const clang::Expr *>
45
parseAssignment(const Stmt *S);
46
47
// Do not reorder! The getMostNullable method relies on the order.
48
// Optimization: Most pointers expected to be unspecified. When a symbol has an
49
// unspecified or nonnull type non of the rules would indicate any problem for
50
// that symbol. For this reason only nullable and contradicted nullability are
51
// stored for a symbol. When a symbol is already contradicted, it can not be
52
// casted back to nullable.
53
enum class Nullability : char {
54
  Contradicted, // Tracked nullability is contradicted by an explicit cast. Do
55
                // not report any nullability related issue for this symbol.
56
                // This nullability is propagated aggressively to avoid false
57
                // positive results. See the comment on getMostNullable method.
58
  Nullable,
59
  Unspecified,
60
  Nonnull
61
};
62
63
/// Get nullability annotation for a given type.
64
Nullability getNullabilityAnnotation(QualType Type);
65
66
} // end GR namespace
67
68
} // end clang namespace
69
70
#endif