#ifndef __DEALLOCATOR__INFO__HPP
#define __DEALLOCATOR__INFO__HPP

#include "CommonTypes.hpp"

/*!
  This is a wrapper for some dataflow information for the FinalizerAnalysis
 */
struct deallocator_info
{
  value_set deallocatedOrNull;
  value_set nullValues;
  value_set deallocatedValues;
  
  void merge(const deallocator_info & other)
  {
    this->nullValues.insert(other.nullValues.begin(),
                            other.nullValues.end());
    this->deallocatedValues.insert(other.deallocatedValues.begin(),
                                   other.deallocatedValues.end());
    this->deallocatedOrNull.insert(other.deallocatedOrNull.begin(),
                                   other.deallocatedOrNull.end());
  }
  
  void addNull(const llvm::Value * v)
  {
    this->nullValues.insert(v);
    this->deallocatedOrNull.insert(v);
  }
  
  void addDeallocated(const llvm::Value * v)
  {
    this->deallocatedValues.insert(v);
    this->deallocatedOrNull.insert(v);
  }

  void clear()
  {
    deallocatedValues.clear();
    deallocatedOrNull.clear();
    nullValues.clear();
  }
};
#endif // __DEALLOCATOR__INFO__HPP
