LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/expr - attribute.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 22 60 36.7 %
Date: 2026-03-19 10:41:11 Functions: 4 6 66.7 %
Branches: 2 18 11.1 %

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * This file is part of the cvc5 project.
       3                 :            :  *
       4                 :            :  * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS
       5                 :            :  * in the top-level source directory and their institutional affiliations.
       6                 :            :  * All rights reserved.  See the file COPYING in the top-level source
       7                 :            :  * directory for licensing information.
       8                 :            :  * ****************************************************************************
       9                 :            :  *
      10                 :            :  * AttributeManager implementation.
      11                 :            :  */
      12                 :            : #include "expr/attribute.h"
      13                 :            : 
      14                 :            : #include <utility>
      15                 :            : 
      16                 :            : #include "base/output.h"
      17                 :            : #include "expr/node_value.h"
      18                 :            : 
      19                 :            : using namespace std;
      20                 :            : 
      21                 :            : namespace cvc5::internal {
      22                 :            : namespace expr {
      23                 :            : namespace attr {
      24                 :            : 
      25                 :      78012 : AttributeManager::AttributeManager() :
      26                 :      78012 :   d_inGarbageCollection(false)
      27                 :      78012 : {}
      28                 :            : 
      29                 :  280288135 : bool AttributeManager::inGarbageCollection() const {
      30                 :  280288135 :   return d_inGarbageCollection;
      31                 :            : }
      32                 :            : 
      33                 :          0 : void AttributeManager::debugHook(CVC5_UNUSED int debugFlag)
      34                 :            : {
      35                 :            :   /* DO NOT CHECK IN ANY CODE INTO THE DEBUG HOOKS!
      36                 :            :    * debugHook() is an empty function for the purpose of debugging
      37                 :            :    * the AttributeManager without recompiling all of cvc5.
      38                 :            :    * Formally this is a nop.
      39                 :            :    */
      40                 :          0 : }
      41                 :            : 
      42                 :  161517738 : void AttributeManager::deleteAllAttributes(NodeValue* nv) {
      43 [ -  + ][ -  + ]:  161517738 :   Assert(!inGarbageCollection());
                 [ -  - ]
      44                 :  161517738 :   d_bools.erase(nv);
      45                 :  161517738 :   deleteFromTable(d_ints, nv);
      46                 :  161517738 :   deleteFromTable(d_tnodes, nv);
      47                 :  161517738 :   deleteFromTable(d_nodes, nv);
      48                 :  161517738 :   deleteFromTable(d_types, nv);
      49                 :  161517738 :   deleteFromTable(d_strings, nv);
      50                 :  161517738 : }
      51                 :            : 
      52                 :      72578 : void AttributeManager::deleteAllAttributes() {
      53                 :      72578 :   d_bools.clear();
      54                 :      72578 :   deleteAllFromTable(d_ints);
      55                 :      72578 :   deleteAllFromTable(d_tnodes);
      56                 :      72578 :   deleteAllFromTable(d_nodes);
      57                 :      72578 :   deleteAllFromTable(d_types);
      58                 :      72578 :   deleteAllFromTable(d_strings);
      59                 :      72578 : }
      60                 :            : 
      61                 :          0 : void AttributeManager::deleteAttributes(const AttrIdVec& atids) {
      62                 :            :   typedef std::map<uint64_t, std::vector< uint64_t> > AttrToVecMap;
      63                 :          0 :   AttrToVecMap perTableIds;
      64                 :            : 
      65         [ -  - ]:          0 :   for(AttrIdVec::const_iterator it = atids.begin(), it_end = atids.end(); it != it_end; ++it) {
      66                 :          0 :     const AttributeUniqueId& pair = *(*it);
      67                 :          0 :     std::vector< uint64_t>& inTable = perTableIds[pair.getTableId()];
      68                 :          0 :     inTable.push_back(pair.getWithinTypeId());
      69                 :            :   }
      70                 :          0 :   AttrToVecMap::iterator it = perTableIds.begin(), it_end = perTableIds.end();
      71         [ -  - ]:          0 :   for(; it != it_end; ++it) {
      72                 :          0 :     Assert(((*it).first) <= LastAttrTable);
      73                 :          0 :     AttrTableId tableId = (AttrTableId) ((*it).first);
      74                 :          0 :     std::vector< uint64_t>& ids = (*it).second;
      75                 :          0 :     std::sort(ids.begin(), ids.end());
      76                 :            : 
      77 [ -  - ][ -  - ]:          0 :     switch(tableId) {
         [ -  - ][ -  - ]
      78                 :          0 :     case AttrTableBool:
      79                 :          0 :       Unimplemented() << "delete attributes is unimplemented for bools";
      80                 :            :       break;
      81                 :          0 :     case AttrTableUInt64:
      82                 :          0 :       deleteAttributesFromTable(d_ints, ids);
      83                 :          0 :       break;
      84                 :          0 :     case AttrTableTNode:
      85                 :          0 :       deleteAttributesFromTable(d_tnodes, ids);
      86                 :          0 :       break;
      87                 :          0 :     case AttrTableNode:
      88                 :          0 :       deleteAttributesFromTable(d_nodes, ids);
      89                 :          0 :       break;
      90                 :          0 :     case AttrTableTypeNode:
      91                 :          0 :       deleteAttributesFromTable(d_types, ids);
      92                 :          0 :       break;
      93                 :          0 :     case AttrTableString:
      94                 :          0 :       deleteAttributesFromTable(d_strings, ids);
      95                 :          0 :       break;
      96                 :            : 
      97                 :          0 :     case AttrTableCDBool:
      98                 :            :     case AttrTableCDUInt64:
      99                 :            :     case AttrTableCDTNode:
     100                 :            :     case AttrTableCDNode:
     101                 :            :     case AttrTableCDString:
     102                 :            :     case AttrTableCDPointer:
     103                 :          0 :       Unimplemented() << "CDAttributes cannot be deleted. Contact Tim/Morgan "
     104                 :          0 :                          "if this behavior is desired.";
     105                 :            :       break;
     106                 :            : 
     107                 :          0 :     case LastAttrTable:
     108                 :            :     default:
     109                 :          0 :       Unreachable();
     110                 :            :     }
     111                 :            :   }
     112                 :          0 : }
     113                 :            : 
     114                 :            : }  // namespace attr
     115                 :            : }  // namespace expr
     116                 :            : }  // namespace cvc5::internal

Generated by: LCOV version 1.14