clang  6.0.0svn
ReachableCode.h
Go to the documentation of this file.
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_ANALYSIS_ANALYSES_REACHABLECODE_H
15 #define LLVM_CLANG_ANALYSIS_ANALYSES_REACHABLECODE_H
16 
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  class Preprocessor;
31 }
32 
33 //===----------------------------------------------------------------------===//
34 // API.
35 //===----------------------------------------------------------------------===//
36 
37 namespace clang {
38 namespace reachable_code {
39 
40 /// Classifications of unreachable code.
46 };
47 
48 class Callback {
49  virtual void anchor();
50 public:
51  virtual ~Callback() {}
52  virtual void HandleUnreachable(UnreachableKind UK,
54  SourceRange ConditionVal,
55  SourceRange R1,
56  SourceRange R2) = 0;
57 };
58 
59 /// ScanReachableFromBlock - Mark all blocks reachable from Start.
60 /// Returns the total number of blocks that were marked reachable.
61 unsigned ScanReachableFromBlock(const CFGBlock *Start,
62  llvm::BitVector &Reachable);
63 
65  Callback &CB);
66 
67 }} // end namespace clang::reachable_code
68 
69 #endif
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:26
AnalysisDeclContext contains the context data for the function or method under analysis.
CFGBlock - Represents a single basic block in a source-level CFG.
Definition: CFG.h:422
void FindUnreachableCode(AnalysisDeclContext &AC, Preprocessor &PP, Callback &CB)
unsigned ScanReachableFromBlock(const CFGBlock *Start, llvm::BitVector &Reachable)
ScanReachableFromBlock - Mark all blocks reachable from Start.
Encodes a location in the source.
Dataflow Directional Tag Classes.
UnreachableKind
Classifications of unreachable code.
Definition: ReachableCode.h:41
Defines the clang::SourceLocation class and associated facilities.
A trivial tuple used to represent a source range.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:127