<commit_before>//==- ProgramPoint.h - Program Points for Path-Sensitive Analysis --*- C++ -*-//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the interface ProgramPoint, which identifies a
//  distinct location in a function.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_ANALYSIS_PROGRAM_POINT
#define LLVM_CLANG_ANALYSIS_PROGRAM_POINT

#include "clang/AST/CFG.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include <cassert>

namespace clang {
    
class ProgramPoint {
public:
  enum Kind { BlockEntranceKind=0, PostStmtKind=1, BlockExitKind=2,
              BlockEdgeSrcKind=3, BlockEdgeDstKind=4, BlockEdgeAuxKind=5 }; 
protected:
  uintptr_t Data;

  ProgramPoint(const void* Ptr, Kind k) {
    assert ((reinterpret_cast<uintptr_t>(const_cast<void*>(Ptr)) & 0x7) == 0
            && "Address must have at least an 8-byte alignment.");
    
    Data = reinterpret_cast<uintptr_t>(const_cast<void*>(Ptr)) | k;
  }
  
  ProgramPoint() : Data(0) {}
  
public:    
  unsigned getKind() const { return Data & 0x7; }  
  void* getRawPtr() const { return reinterpret_cast<void*>(Data & ~0x7); }
  void* getRawData() const { return reinterpret_cast<void*>(Data); }
  
  static bool classof(const ProgramPoint*) { return true; }
  bool operator==(const ProgramPoint & RHS) const { return Data == RHS.Data; }
  bool operator!=(const ProgramPoint& RHS) const { return Data != RHS.Data; }
  
  void Profile(llvm::FoldingSetNodeID& ID) const {
    ID.AddInteger(getKind());
    ID.AddPointer(getRawPtr());
  }    
};
               <commit_msg>Added support for ProgramPoints to represent ExplodedNodes in another ExplodedGraph. This allows us to build "layered" ExplodedGraphs where one simulation is layered on another.<commit_after>//==- ProgramPoint.h - Program Points for Path-Sensitive Analysis --*- C++ -*-//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the interface ProgramPoint, which identifies a
//  distinct location in a function.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_ANALYSIS_PROGRAM_POINT
#define LLVM_CLANG_ANALYSIS_PROGRAM_POINT

#include "clang/AST/CFG.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include <cassert>

namespace clang {
    
class ProgramPoint {
public:
  enum Kind { LayeredNodeKind  =  0x0,
              BlockEntranceKind = 0x1,
              PostStmtKind      = 0x2,
              BlockExitKind     = 0x3,
              BlockEdgeSrcKind  = 0x5, // Skip 0x4.
              BlockEdgeDstKind  = 0x6,
              BlockEdgeAuxKind  = 0x7 }; 
protected:
  uintptr_t Data;

  ProgramPoint(const void* Ptr, Kind k) {
    assert ((reinterpret_cast<uintptr_t>(const_cast<void*>(Ptr)) & 0x7) == 0
            && "Address must have at least an 8-byte alignment.");
    
    Data = reinterpret_cast<uintptr_t>(const_cast<void*>(Ptr)) | k;
  }
  
  ProgramPoint() : Data(0) {}
  
public:    
  
  unsigned getKind() const { 
    unsigned x = Data & 0x7;
    return x & 0x3 ? x : 0;  // Use only lower 2 bits for 0x0.
  }  
  
  void* getRawPtr() const {
    return (void*) (getKind() ? Data & ~0x7 : Data & ~0x3);
  }

  void* getRawData() const { return reinterpret_cast<void*>(Data); }
  
  static bool classof(const ProgramPoint*) { return true; }
  bool operator==(const ProgramPoint & RHS) const { return Data == RHS.Data; }
  bool operator!=(const ProgramPoint& RHS) const { return Data != RHS.Data; }
  
  void Profile(llvm::FoldingSetNodeID& ID) const {
    ID.AddInteger(getKind());
    ID.AddPointer(getRawPtr());
  }    
};
  
class ExplodedNodeImpl;
template <typename StateTy> class ExplodedNode;
  
class LayeredNode : public ProgramPoint {
public:
  LayeredNode(ExplodedNodeImpl* N) : ProgramPoint(N, LayeredNodeKind) {
    assert (reinterpret_cast<uintptr_t>(N) & 0x3 == 0 &&
            "Address of ExplodedNode must have 4-byte alignment.");
  }
  
  ExplodedNodeImpl* getNodeImpl() const {
    return (ExplodedNodeImpl*) getRawPtr();
  }

  template <typename StateTy>
  ExplodedNode<StateTy>* getNode() const {
    return (ExplodedNode<StateTy>*) getRawPtr();
  }

};
               
{'fraction_non_alphanumeric': 0.17949799620333262, 'fraction_numerical': 0.01096815017928707, 'mean_word_length': 2.4970501474926254, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '914792', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1457, 'n_words': 372}