dawn-cmake/src
Ben Clayton cfed1cb01e ast: Tweak cloning rules for module-scope decls
Previously the Clone() of the AST would clone all the functions, globals
and type declarations in a temporary vector, then assign this to the
ast::Module. This meant that adding new module-scope declarations inside
callbacks of ReplaceAll() would place them right at the top, before any
of the cloned declarations.

As top-level declarations are not statements, ensuring that a new object
comes before the current ReplaceAll() declaration is surprisingly
tricky.

With this change, we can now safely assume that calling
ProgramBuilder::Var(), ProgramBuilder::Func(), ProgramBuilder::Alias()
or ProgramBuilder::Structure() inside a ReplaceAll() will add that
module-scoped declaration before the currently processed top-level
declaration.

Change-Id: I52772fdc85940c8ac8d941fbd53374a4dd64a9f4
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54320
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
2021-06-16 09:19:36 +00:00
..
ast ast: Tweak cloning rules for module-scope decls 2021-06-16 09:19:36 +00:00
diagnostic diagnostic: Fix stupid bug in Formatter::format 2021-06-07 16:53:32 +00:00
inspector resolver: Validate that a call statement has no return value 2021-06-11 13:22:27 +00:00
reader spirv-reader: handle initialized gl_Position 2021-06-16 01:33:38 +00:00
resolver validation: cannot store into a read-only type 2021-06-15 22:39:19 +00:00
sem writer/hlsl: Simplify emission logic, clean up output 2021-06-16 09:19:36 +00:00
transform transform/bound_array_accessors: Use new arrayLength overload 2021-06-15 15:05:17 +00:00
utils resolver: Validate pipline stage use for intrinsics 2021-06-03 16:07:34 +00:00
val val: Use the metal API to validate MSL shaders, if available 2021-06-08 19:38:27 +00:00
writer writer/hlsl: Simplify emission logic, clean up output 2021-06-16 09:19:36 +00:00
BUILD.gn ast: Replace NamedType with TypeDecl 2021-06-09 14:32:14 +00:00
CMakeLists.txt writer/hlsl: Simplify emission logic, clean up output 2021-06-16 09:19:36 +00:00
block_allocator.h Remove sem::AccessControl 2021-05-14 17:51:13 +00:00
block_allocator_test.cc Add tint::BlockAllocator<T> 2021-01-21 15:30:10 +00:00
castable.cc Pull Is() out of castable and into a new TypeInfo 2021-03-02 20:30:08 +00:00
castable.h castable.h: Fix warning 2021-04-30 21:27:02 +00:00
castable_test.cc Castable: Add FLAGS template argument for Is,As 2021-04-16 15:05:44 +00:00
clone_context.cc Remove ShareableCloneable 2021-05-19 13:25:08 +00:00
clone_context.h ast: Tweak cloning rules for module-scope decls 2021-06-16 09:19:36 +00:00
clone_context_test.cc CloneContext: Add InsertBack() 2021-05-26 15:12:12 +00:00
debug.cc Remove all unnecessary includes 2021-03-09 11:11:17 +00:00
debug.h debug: Add TINT_UNIMPLEMENTED() 2021-03-17 04:55:33 +00:00
debug_test.cc Add TINT_ASSERT() 2021-03-09 13:52:18 +00:00
demangler.cc Validate that Symbols are all part of the same program 2021-04-15 18:20:03 +00:00
demangler.h Simplify calls to ast::Node::[to_]str() 2021-01-29 11:22:40 +00:00
demangler_test.cc Validate that Symbols are all part of the same program 2021-04-15 18:20:03 +00:00
intrinsic_table.cc intrinsic_table.def: Support [[deprecated]] on fn 2021-06-10 17:31:54 +00:00
intrinsic_table.h src: Reimplement IntrinsicTable from intrisics.def 2021-06-01 19:06:31 +00:00
intrinsic_table.inl intrinsics: textureSampleCompareLevel() 2021-06-14 15:29:34 +00:00
intrinsic_table.inl.tmpl intrinsic_table.def: Support [[deprecated]] on fn 2021-06-10 17:31:54 +00:00
intrinsic_table_test.cc Add optional access to ptr<> 2021-06-04 22:17:37 +00:00
intrinsics.def intrinsics: textureSampleCompareLevel() 2021-06-14 15:29:34 +00:00
program.cc ast: Replace NamedType with TypeDecl 2021-06-09 14:32:14 +00:00
program.h ast: Replace NamedType with TypeDecl 2021-06-09 14:32:14 +00:00
program_builder.cc resolver: Validate that a call statement has no return value 2021-06-11 13:22:27 +00:00
program_builder.h resolver: Validate that a call statement has no return value 2021-06-11 13:22:27 +00:00
program_builder_test.cc Remove typ::TypePair. 2021-05-20 15:10:48 +00:00
program_id.cc Add ProgramID feed it into all ast::Nodes 2021-04-13 23:27:27 +00:00
program_id.h ast: Validate that ASTs are all part of the same program 2021-04-15 17:47:23 +00:00
program_test.cc Rename 'constructed types' to 'type declarartions' 2021-06-09 14:32:14 +00:00
scope_stack.h Add std::hash<tint::Symbol> specialization 2021-01-11 22:02:42 +00:00
scope_stack_test.cc Validate that Symbols are all part of the same program 2021-04-15 18:20:03 +00:00
source.cc Resolver: Check that every AST node is reached once 2021-04-19 19:16:12 +00:00
source.h wgsl parser: use new TypesBuilder factory functions, and set Source for ast::Type nodes 2021-04-27 17:32:37 +00:00
symbol.cc Validate that Symbols are all part of the same program 2021-04-15 18:20:03 +00:00
symbol.h Validate that Symbols are all part of the same program 2021-04-15 18:20:03 +00:00
symbol_table.cc Validate that Symbols are all part of the same program 2021-04-15 18:20:03 +00:00
symbol_table.h Validate that Symbols are all part of the same program 2021-04-15 18:20:03 +00:00
symbol_table_test.cc Validate that Symbols are all part of the same program 2021-04-15 18:20:03 +00:00
symbol_test.cc Validate that Symbols are all part of the same program 2021-04-15 18:20:03 +00:00
test_main.cc test: Remove HLSL & MSL Validate() logic 2021-06-11 13:22:27 +00:00
traits.h Validate function call arguments 2021-06-09 20:17:59 +00:00
traits_test.cc Remove all unnecessary includes 2021-03-09 11:11:17 +00:00