Rename sem_*.cc to *.cc
This makes the .cc files match the header file name, which allows for the text editor "header flip" feature to actually work. The reason these files were named this way was because GN doesn't allow name conflicts in the same source set, despite the files being in different directories. This change splits the files into different source sets. To do so, we use GN templates, which also reduces duplication in each target definition. Bug: tint:724 Change-Id: I9a7ed3912e4b85b2b38d360805203f3488b86c4c Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/48160 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
parent
08031f326c
commit
3244bcdb67
169
src/BUILD.gn
169
src/BUILD.gn
|
@ -221,7 +221,64 @@ tint_language_header("cldebuginfo100") {
|
|||
# use the build flags to control what is included, instead of trying to specify
|
||||
# the subsets that they want.
|
||||
|
||||
source_set("libtint_core_src") {
|
||||
template("libtint_source_set") {
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*", [ "configs" ])
|
||||
|
||||
if (!defined(invoker.deps)) {
|
||||
deps = []
|
||||
}
|
||||
deps += [
|
||||
":tint_core_enums_unified1",
|
||||
":tint_core_tables_unified1",
|
||||
":tint_language_header_cldebuginfo100",
|
||||
":tint_language_header_debuginfo",
|
||||
"${tint_spirv_headers_dir}:spv_headers",
|
||||
"${tint_spirv_tools_dir}:spvtools_headers",
|
||||
]
|
||||
|
||||
if (defined(invoker.configs)) {
|
||||
configs += invoker.configs
|
||||
}
|
||||
configs += [ ":tint_common_config" ]
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
if (!defined(invoker.public_configs)) {
|
||||
public_configs = []
|
||||
}
|
||||
public_configs += [ ":tint_public_config" ]
|
||||
}
|
||||
}
|
||||
|
||||
libtint_source_set("libtint_sem_src") {
|
||||
sources = [
|
||||
"sem/array.cc",
|
||||
"sem/array.h",
|
||||
"sem/call.cc",
|
||||
"sem/call.h",
|
||||
"sem/call_target.cc",
|
||||
"sem/call_target.h",
|
||||
"sem/expression.cc",
|
||||
"sem/expression.h",
|
||||
"sem/function.cc",
|
||||
"sem/info.cc",
|
||||
"sem/info.h",
|
||||
"sem/intrinsic.cc",
|
||||
"sem/intrinsic.h",
|
||||
"sem/member_accessor_expression.cc",
|
||||
"sem/node.cc",
|
||||
"sem/node.h",
|
||||
"sem/statement.cc",
|
||||
"sem/struct.cc",
|
||||
"sem/type_mappings.h",
|
||||
"sem/variable.cc",
|
||||
]
|
||||
}
|
||||
|
||||
libtint_source_set("libtint_core_all_src") {
|
||||
sources = [
|
||||
"ast/access_control.cc",
|
||||
"ast/access_control.h",
|
||||
|
@ -373,26 +430,6 @@ source_set("libtint_core_src") {
|
|||
"resolver/resolver.cc",
|
||||
"resolver/resolver.h",
|
||||
"scope_stack.h",
|
||||
"sem/array.h",
|
||||
"sem/call.h",
|
||||
"sem/call_target.h",
|
||||
"sem/expression.h",
|
||||
"sem/info.h",
|
||||
"sem/intrinsic.h",
|
||||
"sem/node.h",
|
||||
"sem/sem_array.cc",
|
||||
"sem/sem_call.cc",
|
||||
"sem/sem_call_target.cc",
|
||||
"sem/sem_expression.cc",
|
||||
"sem/sem_function.cc",
|
||||
"sem/sem_info.cc",
|
||||
"sem/sem_intrinsic.cc",
|
||||
"sem/sem_member_accessor_expression.cc",
|
||||
"sem/sem_node.cc",
|
||||
"sem/sem_statement.cc",
|
||||
"sem/sem_struct.cc",
|
||||
"sem/sem_variable.cc",
|
||||
"sem/type_mappings.h",
|
||||
"source.cc",
|
||||
"source.h",
|
||||
"symbol.cc",
|
||||
|
@ -486,26 +523,16 @@ source_set("libtint_core_src") {
|
|||
} else {
|
||||
sources += [ "diagnostic/printer_other.cc" ]
|
||||
}
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
":tint_core_enums_unified1",
|
||||
":tint_core_tables_unified1",
|
||||
":tint_language_header_cldebuginfo100",
|
||||
":tint_language_header_debuginfo",
|
||||
"${tint_spirv_headers_dir}:spv_headers",
|
||||
"${tint_spirv_tools_dir}:spvtools_headers",
|
||||
libtint_source_set("libtint_core_src") {
|
||||
deps = [
|
||||
":libtint_core_all_src",
|
||||
":libtint_sem_src",
|
||||
]
|
||||
|
||||
configs += [ ":tint_common_config" ]
|
||||
public_configs = [ ":tint_public_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
}
|
||||
|
||||
source_set("libtint_spv_reader_src") {
|
||||
libtint_source_set("libtint_spv_reader_src") {
|
||||
sources = [
|
||||
"reader/spirv/construct.cc",
|
||||
"reader/spirv/construct.h",
|
||||
|
@ -525,28 +552,10 @@ source_set("libtint_spv_reader_src") {
|
|||
"reader/spirv/usage.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":tint_core_enums_unified1",
|
||||
":tint_core_tables_unified1",
|
||||
":tint_language_header_cldebuginfo100",
|
||||
":tint_language_header_debuginfo",
|
||||
"${tint_spirv_tools_dir}/:spvtools",
|
||||
"${tint_spirv_tools_dir}/:spvtools_opt",
|
||||
"${tint_spirv_tools_dir}/:spvtools_val",
|
||||
]
|
||||
|
||||
configs += [ ":tint_common_config" ]
|
||||
public_configs = [ ":tint_public_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
public_deps = [ ":libtint_core_src" ]
|
||||
}
|
||||
|
||||
source_set("libtint_spv_writer_src") {
|
||||
libtint_source_set("libtint_spv_writer_src") {
|
||||
sources = [
|
||||
"transform/spirv.cc",
|
||||
"transform/spirv.h",
|
||||
|
@ -565,18 +574,10 @@ source_set("libtint_spv_writer_src") {
|
|||
"writer/spirv/scalar_constant.h",
|
||||
]
|
||||
|
||||
configs += [ ":tint_common_config" ]
|
||||
public_configs = [ ":tint_public_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
public_deps = [ ":libtint_core_src" ]
|
||||
}
|
||||
|
||||
source_set("libtint_wgsl_reader_src") {
|
||||
libtint_source_set("libtint_wgsl_reader_src") {
|
||||
sources = [
|
||||
"reader/wgsl/lexer.cc",
|
||||
"reader/wgsl/lexer.h",
|
||||
|
@ -589,18 +590,10 @@ source_set("libtint_wgsl_reader_src") {
|
|||
"reader/wgsl/token.h",
|
||||
]
|
||||
|
||||
configs += [ ":tint_common_config" ]
|
||||
public_configs = [ ":tint_public_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
public_deps = [ ":libtint_core_src" ]
|
||||
}
|
||||
|
||||
source_set("libtint_wgsl_writer_src") {
|
||||
libtint_source_set("libtint_wgsl_writer_src") {
|
||||
sources = [
|
||||
"writer/wgsl/generator.cc",
|
||||
"writer/wgsl/generator.h",
|
||||
|
@ -608,18 +601,10 @@ source_set("libtint_wgsl_writer_src") {
|
|||
"writer/wgsl/generator_impl.h",
|
||||
]
|
||||
|
||||
configs += [ ":tint_common_config" ]
|
||||
public_configs = [ ":tint_public_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
public_deps = [ ":libtint_core_src" ]
|
||||
}
|
||||
|
||||
source_set("libtint_msl_writer_src") {
|
||||
libtint_source_set("libtint_msl_writer_src") {
|
||||
sources = [
|
||||
"transform/msl.cc",
|
||||
"transform/msl.h",
|
||||
|
@ -629,18 +614,10 @@ source_set("libtint_msl_writer_src") {
|
|||
"writer/msl/generator_impl.h",
|
||||
]
|
||||
|
||||
configs += [ ":tint_common_config" ]
|
||||
public_configs = [ ":tint_public_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
public_deps = [ ":libtint_core_src" ]
|
||||
}
|
||||
|
||||
source_set("libtint_hlsl_writer_src") {
|
||||
libtint_source_set("libtint_hlsl_writer_src") {
|
||||
sources = [
|
||||
"transform/hlsl.cc",
|
||||
"transform/hlsl.h",
|
||||
|
@ -650,14 +627,6 @@ source_set("libtint_hlsl_writer_src") {
|
|||
"writer/hlsl/generator_impl.h",
|
||||
]
|
||||
|
||||
configs += [ ":tint_common_config" ]
|
||||
public_configs = [ ":tint_public_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
public_deps = [ ":libtint_core_src" ]
|
||||
}
|
||||
|
||||
|
|
|
@ -195,18 +195,18 @@ set(TINT_LIB_SRCS
|
|||
sem/info.h
|
||||
sem/intrinsic.h
|
||||
sem/node.h
|
||||
sem/sem_array.cc
|
||||
sem/sem_call.cc
|
||||
sem/sem_call_target.cc
|
||||
sem/sem_expression.cc
|
||||
sem/sem_member_accessor_expression.cc
|
||||
sem/sem_function.cc
|
||||
sem/sem_info.cc
|
||||
sem/sem_intrinsic.cc
|
||||
sem/sem_node.cc
|
||||
sem/sem_statement.cc
|
||||
sem/sem_struct.cc
|
||||
sem/sem_variable.cc
|
||||
sem/array.cc
|
||||
sem/call.cc
|
||||
sem/call_target.cc
|
||||
sem/expression.cc
|
||||
sem/member_accessor_expression.cc
|
||||
sem/function.cc
|
||||
sem/info.cc
|
||||
sem/intrinsic.cc
|
||||
sem/node.cc
|
||||
sem/statement.cc
|
||||
sem/struct.cc
|
||||
sem/variable.cc
|
||||
sem/type_mappings.h
|
||||
source.cc
|
||||
source.h
|
||||
|
@ -496,7 +496,7 @@ if(${TINT_BUILD_TESTS})
|
|||
resolver/type_validation_test.cc
|
||||
resolver/validation_test.cc
|
||||
scope_stack_test.cc
|
||||
sem/sem_intrinsic_test.cc
|
||||
sem/intrinsic_test.cc
|
||||
symbol_table_test.cc
|
||||
symbol_test.cc
|
||||
traits_test.cc
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "src/ast/member_accessor_expression.h"
|
||||
#include "src/sem/member_accessor_expression.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::MemberAccessorExpression);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::StructMemberAccess);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::Swizzle);
|
|
@ -12,8 +12,10 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "src/ast/struct_member.h"
|
||||
#include "src/sem/struct.h"
|
||||
#include "src/ast/struct_member.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::Struct);
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::sem::StructMember);
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "src/ast/storage_class.h"
|
||||
#include "src/sem/node.h"
|
||||
#include "src/symbol.h"
|
||||
|
||||
namespace tint {
|
||||
|
||||
|
|
146
test/BUILD.gn
146
test/BUILD.gn
|
@ -107,7 +107,36 @@ config("tint_unittests_config") {
|
|||
]
|
||||
}
|
||||
|
||||
source_set("tint_unittests_core_src") {
|
||||
template("tint_unittests_source_set") {
|
||||
source_set(target_name) {
|
||||
forward_variables_from(invoker, "*", [ "configs" ])
|
||||
|
||||
if (defined(invoker.configs)) {
|
||||
configs += invoker.configs
|
||||
}
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
testonly = true
|
||||
|
||||
if (!defined(invoker.deps)) {
|
||||
deps = []
|
||||
}
|
||||
deps += [
|
||||
":gmock_and_gtest",
|
||||
"${tint_root_dir}/src:libtint_core_src",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_core_sem_src") {
|
||||
sources = [ "../src/sem/intrinsic_test.cc" ]
|
||||
}
|
||||
|
||||
tint_unittests_source_set("tint_unittests_core_src") {
|
||||
sources = [
|
||||
"../src/ast/access_decoration_test.cc",
|
||||
"../src/ast/array_accessor_expression_test.cc",
|
||||
|
@ -190,7 +219,6 @@ source_set("tint_unittests_core_src") {
|
|||
"../src/resolver/type_validation_test.cc",
|
||||
"../src/resolver/validation_test.cc",
|
||||
"../src/scope_stack_test.cc",
|
||||
"../src/sem/sem_intrinsic_test.cc",
|
||||
"../src/symbol_table_test.cc",
|
||||
"../src/symbol_test.cc",
|
||||
"../src/traits_test.cc",
|
||||
|
@ -245,24 +273,14 @@ source_set("tint_unittests_core_src") {
|
|||
sources += [ "../src/utils/tmpfile_other.cc" ]
|
||||
}
|
||||
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
":gmock_and_gtest",
|
||||
"${tint_root_dir}/src:libtint_core_src",
|
||||
":tint_unittests_core_sem_src",
|
||||
"${tint_root_dir}/src:libtint_wgsl_reader_src",
|
||||
"${tint_root_dir}/src:libtint_wgsl_writer_src",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("tint_unittests_spv_reader_src") {
|
||||
tint_unittests_source_set("tint_unittests_spv_reader_src") {
|
||||
sources = [
|
||||
"../src/reader/spirv/enum_converter_test.cc",
|
||||
"../src/reader/spirv/fail_stream_test.cc",
|
||||
|
@ -296,23 +314,10 @@ source_set("tint_unittests_spv_reader_src") {
|
|||
"../src/reader/spirv/usage_test.cc",
|
||||
]
|
||||
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
deps = [ "${tint_root_dir}/src:libtint_spv_reader_src" ]
|
||||
}
|
||||
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
":gmock_and_gtest",
|
||||
":tint_unittests_core_src",
|
||||
"${tint_root_dir}/src:libtint_spv_reader_src",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("tint_unittests_spv_writer_src") {
|
||||
tint_unittests_source_set("tint_unittests_spv_writer_src") {
|
||||
sources = [
|
||||
"../src/transform/spirv_test.cc",
|
||||
"../src/writer/spirv/binary_writer_test.cc",
|
||||
|
@ -349,23 +354,10 @@ source_set("tint_unittests_spv_writer_src") {
|
|||
"../src/writer/spirv/test_helper.h",
|
||||
]
|
||||
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
deps = [ "${tint_root_dir}/src:libtint_spv_writer_src" ]
|
||||
}
|
||||
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
":gmock_and_gtest",
|
||||
":tint_unittests_core_src",
|
||||
"${tint_root_dir}/src:libtint_spv_writer_src",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("tint_unittests_wgsl_reader_src") {
|
||||
tint_unittests_source_set("tint_unittests_wgsl_reader_src") {
|
||||
sources = [
|
||||
"../src/reader/wgsl/lexer_test.cc",
|
||||
"../src/reader/wgsl/parser_impl_additive_expression_test.cc",
|
||||
|
@ -443,23 +435,10 @@ source_set("tint_unittests_wgsl_reader_src") {
|
|||
"../src/reader/wgsl/token_test.cc",
|
||||
]
|
||||
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
deps = [ "${tint_root_dir}/src:libtint_wgsl_reader_src" ]
|
||||
}
|
||||
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
":gmock_and_gtest",
|
||||
":tint_unittests_core_src",
|
||||
"${tint_root_dir}/src:libtint_wgsl_reader_src",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("tint_unittests_wgsl_writer_src") {
|
||||
tint_unittests_source_set("tint_unittests_wgsl_writer_src") {
|
||||
sources = [
|
||||
"../src/writer/wgsl/generator_impl_alias_type_test.cc",
|
||||
"../src/writer/wgsl/generator_impl_array_accessor_test.cc",
|
||||
|
@ -492,23 +471,10 @@ source_set("tint_unittests_wgsl_writer_src") {
|
|||
"../src/writer/wgsl/test_helper.h",
|
||||
]
|
||||
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
deps = [ "${tint_root_dir}/src:libtint_wgsl_writer_src" ]
|
||||
}
|
||||
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
":gmock_and_gtest",
|
||||
":tint_unittests_core_src",
|
||||
"${tint_root_dir}/src:libtint_wgsl_writer_src",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("tint_unittests_msl_writer_src") {
|
||||
tint_unittests_source_set("tint_unittests_msl_writer_src") {
|
||||
sources = [
|
||||
"../src/transform/msl_test.cc",
|
||||
"../src/writer/msl/generator_impl_alias_type_test.cc",
|
||||
|
@ -544,23 +510,10 @@ source_set("tint_unittests_msl_writer_src") {
|
|||
"../src/writer/msl/test_helper.h",
|
||||
]
|
||||
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
deps = [ "${tint_root_dir}/src:libtint_msl_writer_src" ]
|
||||
}
|
||||
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
":gmock_and_gtest",
|
||||
":tint_unittests_core_src",
|
||||
"${tint_root_dir}/src:libtint_msl_writer_src",
|
||||
]
|
||||
}
|
||||
|
||||
source_set("tint_unittests_hlsl_writer_src") {
|
||||
tint_unittests_source_set("tint_unittests_hlsl_writer_src") {
|
||||
sources = [
|
||||
"../src/transform/hlsl_test.cc",
|
||||
"../src/writer/hlsl/generator_impl_alias_type_test.cc",
|
||||
|
@ -598,20 +551,7 @@ source_set("tint_unittests_hlsl_writer_src") {
|
|||
"../src/writer/hlsl/test_helper.h",
|
||||
]
|
||||
|
||||
configs += [ ":tint_unittests_config" ]
|
||||
|
||||
if (build_with_chromium) {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
}
|
||||
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
":gmock_and_gtest",
|
||||
":tint_unittests_core_src",
|
||||
"${tint_root_dir}/src:libtint_hlsl_writer_src",
|
||||
]
|
||||
deps = [ "${tint_root_dir}/src:libtint_hlsl_writer_src" ]
|
||||
}
|
||||
|
||||
source_set("tint_unittests_src") {
|
||||
|
|
Loading…
Reference in New Issue