CloneContext: Assert objects are owned by the program

Check that pre-clone objects are owned by the source program.
Check that post-clone object are owned by the target builder.

Fixed: tint:469
Change-Id: Idd0eeb8dfb386e295b66b4b6621cc13dc1a30786
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48260
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-04-19 16:50:23 +00:00
committed by Commit Bot service account
parent b895ba1cea
commit 917b14b626
6 changed files with 88 additions and 3 deletions

View File

@@ -81,7 +81,7 @@ class Node : public Castable<Node, Cloneable> {
/// @param node a pointer to an AST node
/// @returns the ProgramID of the given AST node.
inline ProgramID ProgramIDOf(ast::Node* node) {
inline ProgramID ProgramIDOf(const ast::Node* node) {
return node ? node->program_id() : ProgramID();
}