int cil_gen_node(struct cil_db *db, struct cil_tree_node *ast_node, struct cil_symtab_datum *datum, hashtab_key_t key, enum cil_sym_index sflavor, enum cil_flavor nflavor)
{
	int rc = SEPOL_ERR;
	symtab_t *symtab = NULL;

	rc = cil_verify_name((const char*)key, nflavor);
	if (rc != SEPOL_OK) {
		goto exit;
	}

	rc = cil_get_symtab(ast_node->parent, &symtab, sflavor);
	if (rc != SEPOL_OK) {
		goto exit;
	}

	ast_node->data = datum;
	ast_node->flavor = nflavor;

	rc = cil_add_decl_to_symtab(db, symtab, key, datum, ast_node);
	if (rc != SEPOL_OK) {
		goto exit;
	}

	if (ast_node->parent->flavor == CIL_MACRO) {
		rc = cil_verify_decl_does_not_shadow_macro_parameter(ast_node->parent->data, ast_node, key);
		if (rc != SEPOL_OK) {
			goto exit;
		}
	}

	return SEPOL_OK;

exit:
	return rc;
}
int cil_gen_node(struct cil_db *db, struct cil_tree_node *ast_node, struct cil_symtab_datum *datum, hashtab_key_t key, enum cil_sym_index sflavor, enum cil_flavor nflavor)
{
	int rc = SEPOL_ERR;
	symtab_t *symtab = NULL;

	rc = cil_verify_name((const char*)key, nflavor);
	if (rc != SEPOL_OK) {
		goto exit;
	}

	rc = cil_get_symtab(ast_node->parent, &symtab, sflavor);
	if (rc != SEPOL_OK) {
		goto exit;
	}

	ast_node->data = datum;
	ast_node->flavor = nflavor;

	rc = cil_add_decl_to_symtab(db, symtab, key, datum, ast_node);
	if (rc != SEPOL_OK) {
		goto exit;
	}

	if (ast_node->parent->flavor == CIL_MACRO) {
		rc = cil_verify_decl_does_not_shadow_macro_parameter(ast_node->parent->data, ast_node, key);
		if (rc != SEPOL_OK) {
			goto exit;
		}
	}

	return SEPOL_OK;

exit:
	return rc;
}