clang
20.0.0git
include
clang
Analysis
Analyses
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
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
virtual
~Callback
() {}
51
virtual
void
HandleUnreachable
(
UnreachableKind
UK,
SourceLocation
L,
52
SourceRange
ConditionVal,
SourceRange
R1,
53
SourceRange
R2,
bool
HasFallThroughAttr) = 0;
54
};
55
56
/// ScanReachableFromBlock - Mark all blocks reachable from Start.
57
/// Returns the total number of blocks that were marked reachable.
58
unsigned
ScanReachableFromBlock
(
const
CFGBlock
*Start,
59
llvm::BitVector &Reachable);
60
61
void
FindUnreachableCode
(
AnalysisDeclContext
&AC,
Preprocessor
&PP,
62
Callback
&CB);
63
64
}}
// end namespace clang::reachable_code
65
66
#endif
SourceLocation.h
Defines the clang::SourceLocation class and associated facilities.
clang::AnalysisDeclContext
AnalysisDeclContext contains the context data for the function, method or block under analysis.
Definition:
AnalysisDeclContext.h:72
clang::CFGBlock
Represents a single basic block in a source-level CFG.
Definition:
CFG.h:604
clang::Preprocessor
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition:
Preprocessor.h:137
clang::SourceLocation
Encodes a location in the source.
Definition:
SourceLocation.h:88
clang::SourceRange
A trivial tuple used to represent a source range.
Definition:
SourceLocation.h:213
clang::reachable_code::Callback
Definition:
ReachableCode.h:47
clang::reachable_code::Callback::HandleUnreachable
virtual void HandleUnreachable(UnreachableKind UK, SourceLocation L, SourceRange ConditionVal, SourceRange R1, SourceRange R2, bool HasFallThroughAttr)=0
clang::reachable_code::Callback::~Callback
virtual ~Callback()
Definition:
ReachableCode.h:50
clang::reachable_code::FindUnreachableCode
void FindUnreachableCode(AnalysisDeclContext &AC, Preprocessor &PP, Callback &CB)
Definition:
ReachableCode.cpp:733
clang::reachable_code::ScanReachableFromBlock
unsigned ScanReachableFromBlock(const CFGBlock *Start, llvm::BitVector &Reachable)
ScanReachableFromBlock - Mark all blocks reachable from Start.
Definition:
ReachableCode.cpp:728
clang::reachable_code::UnreachableKind
UnreachableKind
Classifications of unreachable code.
Definition:
ReachableCode.h:40
clang::reachable_code::UK_Break
@ UK_Break
Definition:
ReachableCode.h:42
clang::reachable_code::UK_Other
@ UK_Other
Definition:
ReachableCode.h:44
clang::reachable_code::UK_Return
@ UK_Return
Definition:
ReachableCode.h:41
clang::reachable_code::UK_Loop_Increment
@ UK_Loop_Increment
Definition:
ReachableCode.h:43
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition:
CalledOnceCheck.h:17
llvm
Diagnostic wrappers for TextAPI types for error reporting.
Definition:
Dominators.h:30
Generated on Mon Nov 4 2024 05:34:45 for clang by
1.9.6