Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:26

0001 //===--- CFGStmtMap.h - Map from Stmt* to CFGBlock* -----------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This file defines the CFGStmtMap class, which defines a mapping from
0010 //  Stmt* to CFGBlock*
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CLANG_ANALYSIS_CFGSTMTMAP_H
0015 #define LLVM_CLANG_ANALYSIS_CFGSTMTMAP_H
0016 
0017 #include "clang/Analysis/CFG.h"
0018 
0019 namespace clang {
0020 
0021 class ParentMap;
0022 class Stmt;
0023 
0024 class CFGStmtMap {
0025   ParentMap *PM;
0026   void *M;
0027 
0028   CFGStmtMap(ParentMap *pm, void *m) : PM(pm), M(m) {}
0029   CFGStmtMap(const CFGStmtMap &) = delete;
0030   CFGStmtMap &operator=(const CFGStmtMap &) = delete;
0031 
0032 public:
0033   ~CFGStmtMap();
0034 
0035   /// Returns a new CFGMap for the given CFG.  It is the caller's
0036   /// responsibility to 'delete' this object when done using it.
0037   static CFGStmtMap *Build(CFG* C, ParentMap *PM);
0038 
0039   /// Returns the CFGBlock the specified Stmt* appears in.  For Stmt* that
0040   /// are terminators, the CFGBlock is the block they appear as a terminator,
0041   /// and not the block they appear as a block-level expression (e.g, '&&').
0042   /// CaseStmts and LabelStmts map to the CFGBlock they label.
0043   CFGBlock *getBlock(Stmt * S);
0044 
0045   const CFGBlock *getBlock(const Stmt * S) const {
0046     return const_cast<CFGStmtMap*>(this)->getBlock(const_cast<Stmt*>(S));
0047   }
0048 };
0049 
0050 } // end clang namespace
0051 #endif