1 //===--- CFGStmtMap.h - Map from Stmt* to CFGBlock* -----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the CFGStmtMap class, which defines a mapping from
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_CFGSTMTMAP_H
16 #define LLVM_CLANG_CFGSTMTMAP_H
18 #include "clang/Analysis/CFG.h"
31 CFGStmtMap(ParentMap *pm, void *m) : PM(pm), M(m) {}
36 /// Returns a new CFGMap for the given CFG. It is the caller's
37 /// responsibility to 'delete' this object when done using it.
38 static CFGStmtMap *Build(CFG* C, ParentMap *PM);
40 /// Returns the CFGBlock the specified Stmt* appears in. For Stmt* that
41 /// are terminators, the CFGBlock is the block they appear as a terminator,
42 /// and not the block they appear as a block-level expression (e.g, '&&').
43 /// CaseStmts and LabelStmts map to the CFGBlock they label.
44 CFGBlock *getBlock(Stmt * S);
46 const CFGBlock *getBlock(const Stmt * S) const {
47 return const_cast<CFGStmtMap*>(this)->getBlock(const_cast<Stmt*>(S));
51 } // end clang namespace