Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/Analysis/Analyses/ReachableCode.h
Line
Count
Source
1
//===- ReachableCode.h -----------------------------------------*- 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
// A flow-sensitive, path-insensitive analysis of unreachable code.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_REACHABLECODE_H
14
#define LLVM_CLANG_ANALYSIS_ANALYSES_REACHABLECODE_H
15
16
#include "clang/Basic/SourceLocation.h"
17
18
//===----------------------------------------------------------------------===//
19
// Forward declarations.
20
//===----------------------------------------------------------------------===//
21
22
namespace llvm {
23
  class BitVector;
24
}
25
26
namespace clang {
27
  class AnalysisDeclContext;
28
  class CFGBlock;
29
  class Preprocessor;
30
}
31
32
//===----------------------------------------------------------------------===//
33
// API.
34
//===----------------------------------------------------------------------===//
35
36
namespace clang {
37
namespace reachable_code {
38
39
/// Classifications of unreachable code.
40
enum UnreachableKind {
41
  UK_Return,
42
  UK_Break,
43
  UK_Loop_Increment,
44
  UK_Other
45
};
46
47
class Callback {
48
  virtual void anchor();
49
public:
50
155
  virtual ~Callback() {}
51
  virtual void HandleUnreachable(UnreachableKind UK,
52
                                 SourceLocation L,
53
                                 SourceRange ConditionVal,
54
                                 SourceRange R1,
55
                                 SourceRange R2) = 0;
56
};
57
58
/// ScanReachableFromBlock - Mark all blocks reachable from Start.
59
/// Returns the total number of blocks that were marked reachable.
60
unsigned ScanReachableFromBlock(const CFGBlock *Start,
61
                                llvm::BitVector &Reachable);
62
63
void FindUnreachableCode(AnalysisDeclContext &AC, Preprocessor &PP,
64
                         Callback &CB);
65
66
}} // end namespace clang::reachable_code
67
68
#endif