#include "src/tint/lang/wgsl/resolver/resolver.h"
#include "src/tint/lang/wgsl/resolver/resolver_helper_test.h"
#include "src/tint/utils/text/string_stream.h"
#include "gmock/gmock.h"
namespace tint::resolver {
namespace {
usingnamespacetint::core::fluent_types;
usingnamespacetint::core::number_suffixes;
struct ResolverAliasAnalysisTest : public resolver::TestHelper, public testing::Test { … };
struct TwoPointerConfig { … };
class TwoPointers : public ResolverTestWithParam<TwoPointerConfig> { … };
TEST_P(TwoPointers, ReadRead) { … }
TEST_P(TwoPointers, ReadWrite) { … }
TEST_P(TwoPointers, WriteRead) { … }
TEST_P(TwoPointers, WriteWrite) { … }
TEST_P(TwoPointers, ReadWriteThroughChain) { … }
TEST_P(TwoPointers, ReadWriteAcrossDifferentFunctions) { … }
INSTANTIATE_TEST_SUITE_P(…);
class OnePointerOneModuleScope : public ResolverTestWithParam<bool> { … };
TEST_P(OnePointerOneModuleScope, ReadRead) { … }
TEST_P(OnePointerOneModuleScope, ReadWrite) { … }
TEST_P(OnePointerOneModuleScope, WriteRead) { … }
TEST_P(OnePointerOneModuleScope, WriteWrite) { … }
TEST_P(OnePointerOneModuleScope, ReadWriteThroughChain_GlobalViaArg) { … }
TEST_P(OnePointerOneModuleScope, ReadWriteThroughChain_Both) { … }
TEST_P(OnePointerOneModuleScope, WriteReadThroughChain_GlobalViaArg) { … }
TEST_P(OnePointerOneModuleScope, WriteReadThroughChain_Both) { … }
TEST_P(OnePointerOneModuleScope, ReadWriteAcrossDifferentFunctions) { … }
INSTANTIATE_TEST_SUITE_P(…);
class Use : public ResolverTestWithParam<bool> { … };
TEST_P(Use, NoAccess) { … }
TEST_P(Use, Write_Increment) { … }
TEST_P(Use, Write_Decrement) { … }
TEST_P(Use, Write_CompoundAssignment_LHS) { … }
TEST_P(Use, Read_CompoundAssignment_RHS) { … }
TEST_P(Use, Read_BinaryOp_LHS) { … }
TEST_P(Use, Read_BinaryOp_RHS) { … }
TEST_P(Use, Read_UnaryMinus) { … }
TEST_P(Use, Read_FunctionCallArg) { … }
TEST_P(Use, Read_Bitcast) { … }
TEST_P(Use, Read_Convert) { … }
TEST_P(Use, Read_IndexAccessor) { … }
TEST_P(Use, Read_LetInitializer) { … }
TEST_P(Use, Read_VarInitializer) { … }
TEST_P(Use, Read_ReturnValue) { … }
TEST_P(Use, Read_Switch) { … }
TEST_P(Use, NoAccess_AddressOf_Deref) { … }
INSTANTIATE_TEST_SUITE_P(…);
class UseBool : public ResolverTestWithParam<bool> { … };
TEST_P(UseBool, Read_IfCond) { … }
TEST_P(UseBool, Read_WhileCond) { … }
TEST_P(UseBool, Read_ForCond) { … }
TEST_P(UseBool, Read_BreakIf) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(ResolverAliasAnalysisTest, NoAccess_MemberAccessor) { … }
TEST_F(ResolverAliasAnalysisTest, Read_MemberAccessor) { … }
TEST_F(ResolverAliasAnalysisTest, Write_MemberAccessor) { … }
TEST_F(ResolverAliasAnalysisTest, Read_MultiComponentSwizzle) { … }
TEST_F(ResolverAliasAnalysisTest, Read_MultiComponentSwizzle_FromPointer) { … }
TEST_F(ResolverAliasAnalysisTest, SinglePointerReadWrite) { … }
TEST_F(ResolverAliasAnalysisTest, AliasingInsideFunction) { … }
TEST_F(ResolverAliasAnalysisTest, NonOverlappingCalls) { … }
class AtomicPointers
: public ResolverTestWithParam<
std::tuple<wgsl::BuiltinFn, wgsl::BuiltinFn, core::AddressSpace, bool >> { … };
TEST_P(AtomicPointers, CallDirect) { … }
TEST_P(AtomicPointers, CallThroughChain) { … }
TEST_P(AtomicPointers, ReadWriteAcrossDifferentFunctions) { … }
std::array kAtomicFns{ … };
INSTANTIATE_TEST_SUITE_P(…);
enum class WorkgroupUniformLoadAction { … };
std::array kWorkgroupUniformLoadActions{ … };
class WorkgroupUniformLoad
: public ResolverTestWithParam<
std::tuple<WorkgroupUniformLoadAction, WorkgroupUniformLoadAction, bool>> { … };
TEST_P(WorkgroupUniformLoad, CallDirect) { … }
TEST_P(WorkgroupUniformLoad, CallThroughChain) { … }
TEST_P(WorkgroupUniformLoad, ReadWriteAcrossDifferentFunctions) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
}