schema compile CHANGE compiling leafref types

- allow sharing type structure if it does not change since it does not
contain resolved target node which can differ for each instance
- remember correct context module for the leafref path since it may
contain prefixes which are valid only in the module where the path was
defined.
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index cb7e2a4..6b3e907 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -189,6 +189,14 @@
 struct lysc_iffeature **lysc_node_iff(const struct lysc_node *node);
 
 /**
+ * @brief Get the covering schema module structure for the given parsed module structure.
+ * @param[in] ctx libyang context to search.
+ * @param[in] mod Parsed schema structure.
+ * @return Corresponding lys_module structure for the given parsed schema structure.
+ */
+struct lys_module *lysp_find_module(struct ly_ctx *ctx, const struct lysp_module *mod);
+
+/**
  * @brief Find the module referenced by prefix in the provided parsed mod.
  *
  * @param[in] mod Schema module where the prefix was used.