Context object owns a TypeManager

Add a Context::Reset method to clear state.

Hide the member behind an accessor.

Change-Id: Iafb7c39249f66f70c5a99a8ed1c69f2c0238834f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17742
Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
David Neto
2020-03-27 00:47:16 +00:00
committed by dan sinclair
parent 20145170fc
commit a8cd18e9e7
28 changed files with 152 additions and 136 deletions

View File

@@ -252,10 +252,7 @@ int main(int argc, const char** argv) {
return 1;
}
tint::TypeManager type_manager;
tint::Context ctx;
ctx.type_mgr = &type_manager;
std::unique_ptr<tint::reader::Reader> reader;
#if TINT_BUILD_WGSL_READER
@@ -267,7 +264,7 @@ int main(int argc, const char** argv) {
return 1;
}
reader = std::make_unique<tint::reader::wgsl::Parser>(
ctx, std::string(data.begin(), data.end()));
&ctx, std::string(data.begin(), data.end()));
}
#endif // TINT_BUILD_WGSL_READER
@@ -279,7 +276,7 @@ int main(int argc, const char** argv) {
if (!ReadFile<uint32_t>(options.input_filename, &data)) {
return 1;
}
reader = std::make_unique<tint::reader::spirv::Parser>(ctx, data);
reader = std::make_unique<tint::reader::spirv::Parser>(&ctx, data);
}
#endif // TINT_BUILD_SPV_READER