]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/llvm/tools/clang/include/clang/Analysis/Analyses/ReachableCode.h
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.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 AnalysisContext;
29   class CFGBlock;
30 }
31
32 //===----------------------------------------------------------------------===//
33 // API.
34 //===----------------------------------------------------------------------===//
35
36 namespace clang {
37 namespace reachable_code {
38
39 class Callback {
40 public:
41   virtual ~Callback() {}
42   virtual void HandleUnreachable(SourceLocation L, SourceRange R1,
43                                  SourceRange R2) = 0;
44 };
45
46 /// ScanReachableFromBlock - Mark all blocks reachable from Start.
47 /// Returns the total number of blocks that were marked reachable.  
48 unsigned ScanReachableFromBlock(const CFGBlock *Start,
49                                 llvm::BitVector &Reachable);
50
51 void FindUnreachableCode(AnalysisContext &AC, Callback &CB);
52
53 }} // end namespace clang::reachable_code
54
55 #endif