1 //===--- CFGStmtMap.h - Map from Stmt* to CFGBlock* -----------*- 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 // This file defines the CFGStmtMap class, which defines a mapping from
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_ANALYSIS_CFGSTMTMAP_H
15 #define LLVM_CLANG_ANALYSIS_CFGSTMTMAP_H
17 #include "clang/Analysis/CFG.h"
28 CFGStmtMap(ParentMap *pm, void *m) : PM(pm), M(m) {}
33 /// Returns a new CFGMap for the given CFG. It is the caller's
34 /// responsibility to 'delete' this object when done using it.
35 static CFGStmtMap *Build(CFG* C, ParentMap *PM);
37 /// Returns the CFGBlock the specified Stmt* appears in. For Stmt* that
38 /// are terminators, the CFGBlock is the block they appear as a terminator,
39 /// and not the block they appear as a block-level expression (e.g, '&&').
40 /// CaseStmts and LabelStmts map to the CFGBlock they label.
41 CFGBlock *getBlock(Stmt * S);
43 const CFGBlock *getBlock(const Stmt * S) const {
44 return const_cast<CFGStmtMap*>(this)->getBlock(const_cast<Stmt*>(S));
48 } // end clang namespace