clang 17.0.0git
ReachableCode.h
Go to the documentation of this file.
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
17
18//===----------------------------------------------------------------------===//
19// Forward declarations.
20//===----------------------------------------------------------------------===//
21
22namespace llvm {
23 class BitVector;
24}
25
26namespace clang {
27 class AnalysisDeclContext;
28 class CFGBlock;
29 class Preprocessor;
30}
31
32//===----------------------------------------------------------------------===//
33// API.
34//===----------------------------------------------------------------------===//
35
36namespace clang {
37namespace reachable_code {
38
39/// Classifications of unreachable code.
45};
46
47class Callback {
48 virtual void anchor();
49public:
50 virtual ~Callback() {}
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.
60unsigned ScanReachableFromBlock(const CFGBlock *Start,
61 llvm::BitVector &Reachable);
62
64 Callback &CB);
65
66}} // end namespace clang::reachable_code
67
68#endif
Defines the clang::SourceLocation class and associated facilities.
AnalysisDeclContext contains the context data for the function, method or block under analysis.
Represents a single basic block in a source-level CFG.
Definition: CFG.h:576
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:128
Encodes a location in the source.
A trivial tuple used to represent a source range.
virtual void HandleUnreachable(UnreachableKind UK, SourceLocation L, SourceRange ConditionVal, SourceRange R1, SourceRange R2)=0
void FindUnreachableCode(AnalysisDeclContext &AC, Preprocessor &PP, Callback &CB)
unsigned ScanReachableFromBlock(const CFGBlock *Start, llvm::BitVector &Reachable)
ScanReachableFromBlock - Mark all blocks reachable from Start.
UnreachableKind
Classifications of unreachable code.
Definition: ReachableCode.h:40
YAML serialization mapping.
Definition: Dominators.h:30