Files
Ayush RanjanandgVisor bot 27a81c303b Add support for parsing constants from NVIDIA driver in driver_ast_parser.
The `driver_ast_parser` tool is now able to parse constants alongside with
structs. This is done by adding a new `constants` field in the JSON input, and
a `constants` field in the JSON output. This will be used later to detect
changes in constants between driver versions.

Also, the parser's `structs` argument was renamed to `input` to account for
both structs and constants.

PiperOrigin-RevId: 792677998
2025-08-08 10:39:19 -07:00

58 lines
1.4 KiB
Python

load("//tools:defs.bzl", "cc_binary", "go_binary", "go_test")
package(
default_applicable_licenses = ["//:license"],
licenses = ["notice"],
)
cc_binary(
name = "driver_ast_parser",
srcs = [
"driver_ast_parser.cc",
"driver_ast_parser.h",
],
visibility = [
"//pkg/sentry/devices/nvproxy:__subpackages__",
],
deps = [
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/strings",
"@llvm-project//clang:ast",
"@llvm-project//clang:ast_matchers",
"@llvm-project//clang:tooling",
"@llvm-project//llvm:Support",
"@nlohmann_json//:json",
],
)
go_test(
name = "driver_ast_parser_test",
srcs = ["driver_ast_parser_test.go"],
data = [
"test_struct.cc",
":driver_ast_parser",
],
deps = [
"//pkg/test/testutil",
"//tools/nvidia_driver_differ/parser",
"@com_github_google_go_cmp//cmp:go_default_library",
"@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
],
)
go_binary(
name = "run_differ",
srcs = ["run_differ.go"],
embedsrcs = [
":driver_ast_parser", # keep
],
# Disable nogo tests because this has C++ dependencies.
nogo = False,
deps = [
"//pkg/log",
"//pkg/sentry/devices/nvproxy",
"//pkg/sentry/devices/nvproxy/nvconf",
"//tools/nvidia_driver_differ/parser",
],
)