From c7dcbae41c1d77df2ae7131184741a3d9b665d7d Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 9 Mar 2021 15:08:48 +0000 Subject: [PATCH] Resolver: Place into a resolver namespace I'm going to start pulling apart the resolver tests into separate files, and the test helper shouldn't go into the root tint namespace. Change-Id: Ie7d131c5b92837c6c9df05b2938cf014a0402ce2 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44160 Reviewed-by: Antonio Maiorano Commit-Queue: Antonio Maiorano --- src/program.cc | 2 +- src/resolver/resolver.cc | 2 ++ src/resolver/resolver.h | 3 +++ src/resolver/resolver_test.cc | 4 +++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/program.cc b/src/program.cc index f341e8acf2..3fbf4c9126 100644 --- a/src/program.cc +++ b/src/program.cc @@ -40,7 +40,7 @@ Program::Program(Program&& program) Program::Program(ProgramBuilder&& builder) { is_valid_ = builder.IsValid(); if (builder.ResolveOnBuild() && builder.IsValid()) { - Resolver resolver(&builder); + resolver::Resolver resolver(&builder); if (!resolver.Resolve()) { diagnostics_.add_error(resolver.error()); is_valid_ = false; diff --git a/src/resolver/resolver.cc b/src/resolver/resolver.cc index da144c7b30..07a3c93a91 100644 --- a/src/resolver/resolver.cc +++ b/src/resolver/resolver.cc @@ -37,6 +37,7 @@ #include "src/semantic/variable.h" namespace tint { +namespace resolver { namespace { using IntrinsicType = tint::semantic::IntrinsicType; @@ -961,4 +962,5 @@ Resolver::FunctionInfo::FunctionInfo(ast::Function* decl) : declaration(decl) {} Resolver::FunctionInfo::~FunctionInfo() = default; +} // namespace resolver } // namespace tint diff --git a/src/resolver/resolver.h b/src/resolver/resolver.h index 4a095be7b8..53b38e83e2 100644 --- a/src/resolver/resolver.h +++ b/src/resolver/resolver.h @@ -45,6 +45,8 @@ namespace semantic { class Statement; } // namespace semantic +namespace resolver { + /// Resolves types for all items in the given tint program class Resolver { public: @@ -241,6 +243,7 @@ class Resolver { BlockAllocator function_infos_; }; +} // namespace resolver } // namespace tint #endif // SRC_RESOLVER_RESOLVER_H_ diff --git a/src/resolver/resolver_test.cc b/src/resolver/resolver_test.cc index d3613cd147..3f899a2125 100644 --- a/src/resolver/resolver_test.cc +++ b/src/resolver/resolver_test.cc @@ -40,6 +40,7 @@ using ::testing::ElementsAre; using ::testing::HasSubstr; namespace tint { +namespace resolver { namespace { using IntrinsicType = semantic::IntrinsicType; @@ -3774,10 +3775,11 @@ TEST_P(ResolverTextureIntrinsicTest, Call) { auto* target = call_sem->Target(); ASSERT_NE(target, nullptr); - auto got = ::tint::to_str(param.function, target->Parameters()); + auto got = resolver::to_str(param.function, target->Parameters()); auto* expected = expected_texture_overload(param.overload); EXPECT_EQ(got, expected); } } // namespace +} // namespace resolver } // namespace tint