#include <string>
#include <tuple>
#include <utility>
#include "gmock/gmock.h"
#include "src/tint/lang/core/address_space.h"
#include "src/tint/lang/core/type/texture_dimension.h"
#include "src/tint/lang/wgsl/resolver/dependency_graph.h"
#include "src/tint/lang/wgsl/resolver/resolver_helper_test.h"
#include "src/tint/utils/containers/transform.h"
namespace tint::resolver {
namespace {
ElementsAre;
usingnamespacetint::core::fluent_types;
usingnamespacetint::core::number_suffixes;
template <typename T>
class ResolverDependencyGraphTestWithParam : public ResolverTestWithParam<T> { … };
ResolverDependencyGraphTest;
enum class SymbolDeclKind { … };
static constexpr SymbolDeclKind kAllSymbolDeclKinds[] = …;
static constexpr SymbolDeclKind kTypeDeclKinds[] = …;
static constexpr SymbolDeclKind kValueDeclKinds[] = …;
static constexpr SymbolDeclKind kGlobalDeclKinds[] = …;
static constexpr SymbolDeclKind kLocalDeclKinds[] = …;
static constexpr SymbolDeclKind kGlobalValueDeclKinds[] = …;
static constexpr SymbolDeclKind kFuncDeclKinds[] = …;
enum class SymbolUseKind { … };
static constexpr SymbolUseKind kAllUseKinds[] = …;
static constexpr SymbolUseKind kTypeUseKinds[] = …;
static constexpr SymbolUseKind kValueUseKinds[] = …;
static constexpr SymbolUseKind kFuncUseKinds[] = …;
std::ostream& operator<<(std::ostream& out, SymbolDeclKind kind) { … }
std::ostream& operator<<(std::ostream& out, SymbolUseKind kind) { … }
int ScopeDepth(SymbolDeclKind kind) { … }
int ScopeDepth(SymbolUseKind kind) { … }
struct SymbolTestHelper { … };
SymbolTestHelper::SymbolTestHelper(ProgramBuilder* b) : … { … }
SymbolTestHelper::~SymbolTestHelper() { … }
const ast::Node* SymbolTestHelper::Add(SymbolDeclKind kind, Symbol symbol, Source source = { … }
const ast::Identifier* SymbolTestHelper::Add(SymbolUseKind kind,
Symbol symbol,
Source source = { … }
void SymbolTestHelper::Build() { … }
namespace used_before_decl_tests {
ResolverDependencyGraphUsedBeforeDeclTest;
TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, FuncCall) { … }
TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, TypeConstructed) { … }
TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, TypeUsedByLocal) { … }
TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, TypeUsedByParam) { … }
TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, TypeUsedAsReturnType) { … }
TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, TypeByStructMember) { … }
TEST_F(ResolverDependencyGraphUsedBeforeDeclTest, VarUsed) { … }
}
namespace undeclared_tests {
ResolverDependencyGraphUndeclaredSymbolTest;
TEST_P(ResolverDependencyGraphUndeclaredSymbolTest, Test) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}
namespace undeclared_tests {
ResolverDependencyGraphDeclSelfUse;
TEST_F(ResolverDependencyGraphDeclSelfUse, GlobalVar) { … }
TEST_F(ResolverDependencyGraphDeclSelfUse, GlobalConst) { … }
TEST_F(ResolverDependencyGraphDeclSelfUse, LocalVar) { … }
TEST_F(ResolverDependencyGraphDeclSelfUse, LocalLet) { … }
}
namespace recursive_tests {
ResolverDependencyGraphCyclicRefTest;
TEST_F(ResolverDependencyGraphCyclicRefTest, DirectCall) { … }
TEST_F(ResolverDependencyGraphCyclicRefTest, IndirectCall) { … }
TEST_F(ResolverDependencyGraphCyclicRefTest, Alias_Direct) { … }
TEST_F(ResolverDependencyGraphCyclicRefTest, Alias_Indirect) { … }
TEST_F(ResolverDependencyGraphCyclicRefTest, Struct_Direct) { … }
TEST_F(ResolverDependencyGraphCyclicRefTest, Struct_Indirect) { … }
TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalVar_Direct) { … }
TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalConst_Direct) { … }
TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalVar_Indirect) { … }
TEST_F(ResolverDependencyGraphCyclicRefTest, GlobalConst_Indirect) { … }
TEST_F(ResolverDependencyGraphCyclicRefTest, Mixed_RecursiveDependencies) { … }
}
namespace redeclaration_tests {
ResolverDependencyGraphRedeclarationTest;
TEST_P(ResolverDependencyGraphRedeclarationTest, Test) { … }
INSTANTIATE_TEST_SUITE_P(…);
}
namespace ordered_globals {
ResolverDependencyGraphOrderedGlobalsTest;
TEST_P(ResolverDependencyGraphOrderedGlobalsTest, InOrder) { … }
TEST_P(ResolverDependencyGraphOrderedGlobalsTest, OutOfOrder) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(ResolverDependencyGraphOrderedGlobalsTest, DirectiveFirst) { … }
}
namespace resolve_to_user_decl {
ResolverDependencyGraphResolveToUserDeclTest;
TEST_P(ResolverDependencyGraphResolveToUserDeclTest, Test) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}
namespace resolve_to_builtin_func {
ResolverDependencyGraphResolveToBuiltinFn;
TEST_P(ResolverDependencyGraphResolveToBuiltinFn, Resolve) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}
namespace resolve_to_builtin_type {
ResolverDependencyGraphResolveToBuiltinType;
TEST_P(ResolverDependencyGraphResolveToBuiltinType, Resolve) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}
namespace resolve_to_access {
ResolverDependencyGraphResolveToAccess;
TEST_P(ResolverDependencyGraphResolveToAccess, Resolve) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}
namespace resolve_to_address_space {
ResolverDependencyGraphResolveToAddressSpace;
TEST_P(ResolverDependencyGraphResolveToAddressSpace, Resolve) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}
namespace resolve_to_texel_format {
ResolverDependencyGraphResolveToTexelFormat;
TEST_P(ResolverDependencyGraphResolveToTexelFormat, Resolve) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}
namespace shadowing {
ResolverDependencyGraphShadowScopeTest;
TEST_P(ResolverDependencyGraphShadowScopeTest, Test) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
ResolverDependencyGraphShadowKindTest;
TEST_P(ResolverDependencyGraphShadowKindTest, ShadowedByGlobalVar) { … }
TEST_P(ResolverDependencyGraphShadowKindTest, ShadowedByStruct) { … }
TEST_P(ResolverDependencyGraphShadowKindTest, ShadowedByFunc) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}
namespace ast_traversal {
static const ast::Identifier* IdentifierOf(const ast::IdentifierExpression* expr) { … }
static const ast::Identifier* IdentifierOf(const ast::Identifier* ident) { … }
ResolverDependencyGraphTraversalTest;
TEST_F(ResolverDependencyGraphTraversalTest, SymbolsReached) { … }
TEST_F(ResolverDependencyGraphTraversalTest, InferredType) { … }
TEST_F(ResolverDependencyGraphTraversalTest, chromium_1273451) { … }
}
}
}