1 //===- ReachableCode.h -----------------------------------------*- C++ --*-===//
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
7 //===----------------------------------------------------------------------===//
9 // A flow-sensitive, path-insensitive analysis of unreachable code.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_ANALYSIS_ANALYSES_REACHABLECODE_H
14 #define LLVM_CLANG_ANALYSIS_ANALYSES_REACHABLECODE_H
16 #include "clang/Basic/SourceLocation.h"
18 //===----------------------------------------------------------------------===//
19 // Forward declarations.
20 //===----------------------------------------------------------------------===//
27 class AnalysisDeclContext;
32 //===----------------------------------------------------------------------===//
34 //===----------------------------------------------------------------------===//
37 namespace reachable_code {
39 /// Classifications of unreachable code.
40 enum UnreachableKind {
48 virtual void anchor();
50 virtual ~Callback() {}
51 virtual void HandleUnreachable(UnreachableKind UK,
53 SourceRange ConditionVal,
58 /// ScanReachableFromBlock - Mark all blocks reachable from Start.
59 /// Returns the total number of blocks that were marked reachable.
60 unsigned ScanReachableFromBlock(const CFGBlock *Start,
61 llvm::BitVector &Reachable);
63 void FindUnreachableCode(AnalysisDeclContext &AC, Preprocessor &PP,
66 }} // end namespace clang::reachable_code