@Override
  public boolean isSameType(IType type) {
    if (type instanceof ITypedef) {
      return type.isSameType(this);
    }

    if (type instanceof PDOMNode) {
      PDOMNode node = (PDOMNode) type;
      if (node.getPDOM() == getPDOM()) {
        return node.getRecord() == getRecord();
      }
    }

    if (type instanceof IEnumeration) {
      IEnumeration etype = (IEnumeration) type;
      char[] nchars = etype.getNameCharArray();
      if (nchars.length == 0) {
        nchars = ASTTypeUtil.createNameForAnonymous(etype);
      }
      if (nchars == null || !CharArrayUtils.equals(nchars, getNameCharArray())) return false;

      return SemanticUtil.haveSameOwner(this, etype);
    }
    return false;
  }
  @Override
  public boolean isSameType(IType type) {
    if (type == this) return true;

    if (type instanceof ITypedef) return type.isSameType(this);

    if (type instanceof PDOMNode) {
      PDOMNode node = (PDOMNode) type;
      if (node.getPDOM() == getPDOM()) {
        return node.getRecord() == getRecord();
      }
    }

    // require a class specialization
    if (!(type instanceof ICPPClassSpecialization)) return false;

    return CPPClassSpecialization.isSameClassSpecialization(this, (ICPPClassSpecialization) type);
  }
  public PDOMCPPVariable(
      PDOMLinkage linkage, PDOMNode parent, ICPPVariable variable, boolean setTypeAndValue)
      throws CoreException {
    super(linkage, parent, variable.getNameCharArray());

    // Find the type record
    Database db = getDB();
    db.putByte(record + ANNOTATIONS, PDOMCPPAnnotations.encodeVariableAnnotations(variable));
    if (setTypeAndValue) {
      setType(parent.getLinkage(), variable.getType());
      setValue(variable.getInitialValue());
    }
  }