]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/llvm/tools/clang/include/clang/Analysis/Analyses/ReachableCode.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / llvm / tools / clang / include / clang / Analysis / Analyses / ReachableCode.h
1 //===- ReachableCode.h -----------------------------------------*- 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 // A flow-sensitive, path-insensitive analysis of unreachable code.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CLANG_REACHABLECODE_H
15 #define LLVM_CLANG_REACHABLECODE_H
16
17 #include "clang/Basic/SourceLocation.h"
18
19 //===----------------------------------------------------------------------===//
20 // Forward declarations.
21 //===----------------------------------------------------------------------===//
22
23 namespace llvm {
24   class BitVector;
25 }
26
27 namespace clang {
28   class AnalysisDeclContext;
29   class CFGBlock;
30 }
31
32 //===----------------------------------------------------------------------===//
33 // API.
34 //===----------------------------------------------------------------------===//
35
36 namespace clang {
37 namespace reachable_code {
38
39 class Callback {
40   virtual void anchor();
41 public:
42   virtual ~Callback() {}
43   virtual void HandleUnreachable(SourceLocation L, SourceRange R1,
44                                  SourceRange R2) = 0;
45 };
46
47 /// ScanReachableFromBlock - Mark all blocks reachable from Start.
48 /// Returns the total number of blocks that were marked reachable.  
49 unsigned ScanReachableFromBlock(const CFGBlock *Start,
50                                 llvm::BitVector &Reachable);
51
52 void FindUnreachableCode(AnalysisDeclContext &AC, Callback &CB);
53
54 }} // end namespace clang::reachable_code
55
56 #endif