Bug 1682262 - Update neqo to 0.4.18 and bindgen to 0.56 r=necko-reviewers,emilio,valentin

Differential Revision: https://phabricator.services.mozilla.com/D99665
This commit is contained in:
Dragana Damjanovic 2020-12-14 18:38:49 +00:00
Родитель 48d5acd1fa
Коммит 96b916ebe1
80 изменённых файлов: 2366 добавлений и 1315 удалений

Просмотреть файл

@ -10,7 +10,7 @@ replace-with = "vendored-sources"
[source."https://github.com/mozilla/neqo"]
git = "https://github.com/mozilla/neqo"
replace-with = "vendored-sources"
tag = "v0.4.16"
tag = "v0.4.18"
[source."https://github.com/mozilla/mp4parse-rust"]
git = "https://github.com/mozilla/mp4parse-rust"

35
Cargo.lock сгенерированный
Просмотреть файл

@ -269,13 +269,12 @@ dependencies = [
[[package]]
name = "bindgen"
version = "0.53.2"
version = "0.56.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bb26d6a69a335b8cb0e7c7e9775cd5666611dc50a37177c3f2cedcfc040e8c8"
checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239"
dependencies = [
"bitflags",
"cexpr",
"cfg-if 0.1.10",
"clang-sys",
"lazy_static",
"lazycell",
@ -595,13 +594,13 @@ dependencies = [
[[package]]
name = "clang-sys"
version = "0.29.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f92986241798376849e1a007827041fed9bb36195822c2049d18e174420e0534"
checksum = "0659001ab56b791be01d4b729c44376edc6718cf389a502e579b77b758f3296c"
dependencies = [
"glob",
"libc",
"libloading 0.5.2",
"libloading 0.6.2",
]
[[package]]
@ -728,9 +727,9 @@ dependencies = [
[[package]]
name = "coreaudio-sys"
version = "0.2.4"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e81f1c165c33ffab90a03077ac3b03462b34d5947145dfa48102e063d581502c"
checksum = "2b7e3347be6a09b46aba228d6608386739fb70beff4f61e07422da87b0bb31fa"
dependencies = [
"bindgen",
]
@ -3294,8 +3293,8 @@ dependencies = [
[[package]]
name = "neqo-common"
version = "0.4.16"
source = "git+https://github.com/mozilla/neqo?tag=v0.4.16#1b0664a1e2b3ac59a5c919d32ddc284dc57634e6"
version = "0.4.18"
source = "git+https://github.com/mozilla/neqo?tag=v0.4.18#b4a1dc52b7dcb689a8369b0f529260cadda224c3"
dependencies = [
"chrono",
"env_logger",
@ -3306,8 +3305,8 @@ dependencies = [
[[package]]
name = "neqo-crypto"
version = "0.4.16"
source = "git+https://github.com/mozilla/neqo?tag=v0.4.16#1b0664a1e2b3ac59a5c919d32ddc284dc57634e6"
version = "0.4.18"
source = "git+https://github.com/mozilla/neqo?tag=v0.4.18#b4a1dc52b7dcb689a8369b0f529260cadda224c3"
dependencies = [
"bindgen",
"log",
@ -3319,8 +3318,8 @@ dependencies = [
[[package]]
name = "neqo-http3"
version = "0.4.16"
source = "git+https://github.com/mozilla/neqo?tag=v0.4.16#1b0664a1e2b3ac59a5c919d32ddc284dc57634e6"
version = "0.4.18"
source = "git+https://github.com/mozilla/neqo?tag=v0.4.18#b4a1dc52b7dcb689a8369b0f529260cadda224c3"
dependencies = [
"log",
"neqo-common",
@ -3333,8 +3332,8 @@ dependencies = [
[[package]]
name = "neqo-qpack"
version = "0.4.16"
source = "git+https://github.com/mozilla/neqo?tag=v0.4.16#1b0664a1e2b3ac59a5c919d32ddc284dc57634e6"
version = "0.4.18"
source = "git+https://github.com/mozilla/neqo?tag=v0.4.18#b4a1dc52b7dcb689a8369b0f529260cadda224c3"
dependencies = [
"lazy_static",
"log",
@ -3347,8 +3346,8 @@ dependencies = [
[[package]]
name = "neqo-transport"
version = "0.4.16"
source = "git+https://github.com/mozilla/neqo?tag=v0.4.16#1b0664a1e2b3ac59a5c919d32ddc284dc57634e6"
version = "0.4.18"
source = "git+https://github.com/mozilla/neqo?tag=v0.4.18#b4a1dc52b7dcb689a8369b0f529260cadda224c3"
dependencies = [
"indexmap",
"lazy_static",

Просмотреть файл

@ -20,7 +20,7 @@ serde = { features = ["default", "derive", "rc", "serde_derive", "std"], version
serde_derive = { features = ["default", "deserialize_in_place"], version = "1.0.66" }
quote = { features = ["default", "proc-macro"], version = "1.0" }
libc = { features = ["default", "std", "use_std"], version = "0.2" }
bindgen = { default-features = false, features = ["runtime"], version = "0.53" }
bindgen = { default-features = false, features = ["runtime"], version = "0.56" }
[target."cfg(windows)".dependencies.winapi]
version = "0.3.6"

Просмотреть файл

@ -7,7 +7,7 @@ license = "MPL-2.0"
[build-dependencies]
env_logger = {version = "0.8", default-features = false} # disable `regex` to reduce code size
bindgen = {version = "0.53", default-features = false, features = ["runtime"]} # disable `logging` to reduce code size
bindgen = {version = "0.56", default-features = false, features = ["runtime"]} # disable `logging` to reduce code size
cmake = "0.1"
glob = "0.3"

Просмотреть файл

@ -20,7 +20,7 @@ env_logger = "0.8"
smallvec = "1.0"
[build-dependencies]
bindgen = {version = "0.53", default-features = false} # disable `logging` to reduce code size
bindgen = {version = "0.56", default-features = false} # disable `logging` to reduce code size
[features]
default = ['cranelift-codegen/std']

Просмотреть файл

@ -8,10 +8,10 @@ edition = "2018"
name = "neqo_glue"
[dependencies]
neqo-http3 = { tag = "v0.4.16", git = "https://github.com/mozilla/neqo" }
neqo-transport = { tag = "v0.4.16", git = "https://github.com/mozilla/neqo" }
neqo-common = { tag = "v0.4.16", git = "https://github.com/mozilla/neqo" }
neqo-qpack = { tag = "v0.4.16", git = "https://github.com/mozilla/neqo" }
neqo-http3 = { tag = "v0.4.18", git = "https://github.com/mozilla/neqo" }
neqo-transport = { tag = "v0.4.18", git = "https://github.com/mozilla/neqo" }
neqo-common = { tag = "v0.4.18", git = "https://github.com/mozilla/neqo" }
neqo-qpack = { tag = "v0.4.18", git = "https://github.com/mozilla/neqo" }
nserror = { path = "../../../xpcom/rust/nserror" }
nsstring = { path = "../../../xpcom/rust/nsstring" }
xpcom = { path = "../../../xpcom/rust/xpcom" }
@ -20,7 +20,7 @@ log = "0.4.0"
qlog = "0.3.0"
[dependencies.neqo-crypto]
tag = "v0.4.16"
tag = "v0.4.18"
git = "https://github.com/mozilla/neqo"
default-features = false
features = ["gecko"]

Просмотреть файл

@ -5,23 +5,23 @@ authors = ["Dragana Damjanovic <dragana.damjano@gmail.com>"]
edition = "2018"
[dependencies]
neqo-transport = { tag = "v0.4.16", git = "https://github.com/mozilla/neqo" }
neqo-common = { tag = "v0.4.16", git = "https://github.com/mozilla/neqo" }
neqo-http3 = { tag = "v0.4.16", git = "https://github.com/mozilla/neqo" }
neqo-qpack = { tag = "v0.4.16", git = "https://github.com/mozilla/neqo" }
neqo-transport = { tag = "v0.4.18", git = "https://github.com/mozilla/neqo" }
neqo-common = { tag = "v0.4.18", git = "https://github.com/mozilla/neqo" }
neqo-http3 = { tag = "v0.4.18", git = "https://github.com/mozilla/neqo" }
neqo-qpack = { tag = "v0.4.18", git = "https://github.com/mozilla/neqo" }
mio = "0.6.17"
mio-extras = "2.0.5"
log = "0.4.0"
[dependencies.neqo-crypto]
tag = "v0.4.16"
tag = "v0.4.18"
git = "https://github.com/mozilla/neqo"
default-features = false
features = ["gecko"]
# Make sure to use bindgen's runtime-loading of libclang, as it allows for a wider range of clang versions to be used
[build-dependencies]
bindgen = {version = "0.53.2", default-features = false, features = ["runtime"] }
bindgen = {version = "0.56", default-features = false, features = ["runtime"] }
[[bin]]
name = "http3server"

Просмотреть файл

@ -84,7 +84,7 @@ void = "1.0.2"
[build-dependencies]
lazy_static = "1"
log = "0.4"
bindgen = {version = "0.53", optional = true, default-features = false}
bindgen = {version = "0.56", optional = true, default-features = false}
regex = {version = "1.0", optional = true, default-features = false, features = ["perf", "std"]}
walkdir = "2.1.4"
toml = {version = "0.4.5", optional = true, default-features = false}

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.lock":"21010e02f3dd565f9184d565a22b36c7bcd2d905fa8eda4e454bf5127a48271f","Cargo.toml":"6236f5ccbfbeed5ff84a3c353bbf7048b5670bea0e3538e4994d1f88f1bdf4c3","LICENSE":"c23953d9deb0a3312dbeaf6c128a657f3591acee45067612fa68405eaa4525db","README.md":"5a1f556c6a57c0a6ccc65e19c27718e0f4b32381a8efcc80f6601b33c58c5d59","build.rs":"e1f148e01150af6a66b6af2e5d955c8b9fa092cb4697bae2bcec8a00119055ae","csmith-fuzzing/README.md":"7107b70fedb0c0a0cadb3c439a49c1bd0119a6d38dc63b1aecc74d1942256ef2","src/callbacks.rs":"1e7af281981d26e70e079c7b6569e3c786c298be9cb04872764d73e8d721f053","src/clang.rs":"3b3015a068394e14ab09f41091b0aa3b12eb75e4482052797ce3240cdc3a0aa3","src/codegen/bitfield_unit.rs":"a8fb1a2d97a99685106fcaac87d2013f79d2690d6a46ff05ad1e3629b6075664","src/codegen/bitfield_unit_tests.rs":"dd252134118450800b516e375c872e17b4c1aee63a7b8adbe5b2cd53434bbc7e","src/codegen/error.rs":"5e308b8c54b68511fc8ea2ad15ddac510172c4ff460a80a265336440b0c9653d","src/codegen/helpers.rs":"00af02fd70f7e0a3293bbcb6d76a63908dd163e6ac435e44254c399575afe5ae","src/codegen/impl_debug.rs":"428df604b4be105e3275275e8be81e8306b940abddc1b89675f98a01bf5de8c1","src/codegen/impl_partialeq.rs":"83707f7b13501dc413c904a17163cb54af11e56138f36dfef40ce46c823200fd","src/codegen/mod.rs":"8f0d433412823fa85841d25ff626f50850c6903b145d3c79688eceb0b2c3071c","src/codegen/struct_layout.rs":"0bd30896a81ffb4aa0453602f7a7f38c246fdb8624841bfe55984d6829b46cc4","src/extra_assertions.rs":"494534bd4f18b80d89b180c8a93733e6617edcf7deac413e9a73fd6e7bc9ced7","src/features.rs":"fafb85510b1dfc9a41ed71f7d765fca49b236deb4ee567e00204e751362aaf23","src/ir/analysis/derive.rs":"6e25c277a1acf0565b962a28a272c57661de7e8cb272516f0ee41f04883858ac","src/ir/analysis/has_destructor.rs":"10380d06ed03d058f10f6f6835d9b8fbebac455a1ea218780430a0ffd8d63472","src/ir/analysis/has_float.rs":"1838ba81eb05a9c3e311687e2247d561cc5093377b15ef8008257025ea56da04","src/ir/analysis/has_type_param_in_array.rs":"dddc5511a705e3a653b5e754e359637031b4862e1a1fc1e17f711fb2fbfc1cef","src/ir/analysis/has_vtable.rs":"8da9deec23c4552ecd5b883eaa036e4f2174a5949194c333a62ef463d28dcb6a","src/ir/analysis/mod.rs":"54993cb77df1870bb12cbc6b3a243c2da942cdc967a7d21dacb430601b49b2a1","src/ir/analysis/sizedness.rs":"d0673e19add38a07680ae3a9a5e998a0b2c3917e68efb6639ffe7ea193ada1b1","src/ir/analysis/template_params.rs":"9b662b5ec99cd8409d771a16ee42df500962b0c26f0da85e430ede19cc2b17c9","src/ir/annotations.rs":"268f90fc1d40fadee329c26b183b2aaa9de98f9246fea580404ee0e626315546","src/ir/comment.rs":"31d64a49ae3d9c3c348fa2539e03306ca3a23fae429cab452e42b31ecf632145","src/ir/comp.rs":"4a65eeb1b59fe44b49f453cdaa2616a8eb17fb67de85856bd0522fd4fc0858be","src/ir/context.rs":"59abb2cf8e8169c4247a50298c6a96407f10d7dd736959bdbdf152ef4f502685","src/ir/derive.rs":"e5581852eec87918901a129284b4965aefc8a19394187a8095779a084f28fabe","src/ir/dot.rs":"e25ff72ac174a798894c9673d81bdfb86fa9f4228b34a14ce0dc741a186a52bd","src/ir/enum_ty.rs":"f92220c9603c0746412b605f79f83774bfaa6c2272895945eeb504e6b98d54ef","src/ir/function.rs":"ce4fae30af77eeba74486462a13104e49888c2ba1bcefa8a6654fcf3056ffa06","src/ir/int.rs":"68a86182743ec338d58e42203364dc7c8970cb7ec3550433ca92f0c9489b4442","src/ir/item.rs":"d0804c62421e2c7afefd8844c0231f6f3ee995af6d376446740af425c8cbfb4e","src/ir/item_kind.rs":"7666a1ff1b8260978b790a08b4139ab56b5c65714a5652bbcec7faa7443adc36","src/ir/layout.rs":"936f96fafab34e35b622a5f9e56b0fbd2c97d2e9222470e3687f882f40db1349","src/ir/mod.rs":"713cd537434567003197a123cbae679602c715e976d22f7b23dafd0826ea4c70","src/ir/module.rs":"a26bb0ac90d4cabb0a45d9c1a42b5515c74d4c233dc084e2f85161eac12bff15","src/ir/objc.rs":"a637a0e759fd8d1eaed1afc32f494cb35456b8b1af402c6d59c72b5b29018ebf","src/ir/template.rs":"6c2823c9bab82ab1d70f4d643e8f4d6420be5eafcb78324fb69649e407561cec","src/ir/traversal.rs":"5ac088277f4dfe2918d81b9294aaee41fd83db8e46def66a05f89de078bf4c49","src/ir/ty.rs":"5af2b62d278c679b7c4e597263fce01113e90242e7d263b948d93bc4274dfe9a","src/ir/var.rs":"c5f4bd722a1f7f9e4b1d738204fde3fb47c95778369b83b29e8662211e1717d0","src/lib.rs":"6dfec11ff44c30a67942bc9383a48b9073b08f920af9e06eaecc0fc7c891ba7d","src/log_stubs.rs":"6dfdd908b7c6453da416cf232893768f9480e551ca4add0858ef88bf71ee6ceb","src/main.rs":"d38160b4060fe4fcb286a30f6bd6824764555f6a2c594b5c564d65f4a2ba00de","src/options.rs":"5edc1dae279a95642fbdeb20ffdb447e1fdaf463c90a9b434b984d7e3c718214","src/parse.rs":"be7d13cc84fae79ec7b3aa9e77063fa475a48d74a854423e2c72d75006a25202","src/regex_set.rs":"5cb72fc3714c0d79e9e942d003349c0775fafd7cd0c9603c65f5261883bbf9cf","src/time.rs":"8efe317e7c6b5ba8e0865ce7b49ca775ee8a02590f4241ef62f647fa3c22b68e"},"package":"6bb26d6a69a335b8cb0e7c7e9775cd5666611dc50a37177c3f2cedcfc040e8c8"}
{"files":{"Cargo.lock":"836e8f8431bd4ebdac9b1251676f6afa755757e401455259fe659e7280be8230","Cargo.toml":"3a585a6e27a177f08dedcb21f7d555e9db58fa158203273b228db91ebee4e6b3","LICENSE":"c23953d9deb0a3312dbeaf6c128a657f3591acee45067612fa68405eaa4525db","README.md":"29fe30d7a2729922b13a578bc8f5eedc808fd0f2ef67a3f12017548baf8f293a","build.rs":"3fe1e534c99df4ee207606794f133fb187c0948e055389f74c904994ecaed38a","csmith-fuzzing/README.md":"7107b70fedb0c0a0cadb3c439a49c1bd0119a6d38dc63b1aecc74d1942256ef2","src/callbacks.rs":"1e5a118b94977938751758ac0495b1d41ce5e280c066614a4a7cbd930f326350","src/clang.rs":"aa0644278a8319506be08904c0f6706fbcdcd72eb1e85564b8c7488bd810e126","src/codegen/bitfield_unit.rs":"a8fb1a2d97a99685106fcaac87d2013f79d2690d6a46ff05ad1e3629b6075664","src/codegen/bitfield_unit_tests.rs":"dd252134118450800b516e375c872e17b4c1aee63a7b8adbe5b2cd53434bbc7e","src/codegen/dyngen.rs":"15149bc927e5b2706f93e52a6b26ef55384b3baf40bfc9bc4343e9820479f26b","src/codegen/error.rs":"5e308b8c54b68511fc8ea2ad15ddac510172c4ff460a80a265336440b0c9653d","src/codegen/helpers.rs":"ea83104addb8af31736aaeb850e10c694cd434befe7ffaaa206208f722d72c58","src/codegen/impl_debug.rs":"1ff9ec754b610c98c757b114c6509473ead0e1a9375e9089a7fa40a41a753709","src/codegen/impl_partialeq.rs":"5e526fd88dd15dd1f04addd3c6ecea1d3da92293fadf04346d6c716791f436f9","src/codegen/mod.rs":"19fd11feefab0ff9ecaf8a01583583008269adce805508fb61b9a8acc49da586","src/codegen/struct_layout.rs":"b62c3569dcfb011daa4d09f1aa9eb732da69546c3deb9f247fa8ce7114dbc7b9","src/extra_assertions.rs":"494534bd4f18b80d89b180c8a93733e6617edcf7deac413e9a73fd6e7bc9ced7","src/features.rs":"fafb85510b1dfc9a41ed71f7d765fca49b236deb4ee567e00204e751362aaf23","src/ir/analysis/derive.rs":"ff4821d810961696008a57ae496f95ebcdc14b4c439fe87d78a84817442fa759","src/ir/analysis/has_destructor.rs":"d9a3a24bd4cabc87cddb0c76d27da1691f8f37ffb8eadf5b5975a1c44dea99c2","src/ir/analysis/has_float.rs":"5242cc07ec4d4bdf5a792e1f8ee5758a87838314917d42dbb9dcfc19620520ce","src/ir/analysis/has_type_param_in_array.rs":"ec3fb67f782abb4c866da91bce3f7ee6f8e2310c47a54065282431b909233f7d","src/ir/analysis/has_vtable.rs":"63e2d0f62171811893615c11453bc7b39438d0d83c3eb444dec2346140d86efe","src/ir/analysis/mod.rs":"2c54f0cd6f3d86cf3fcb07d9d0be06cde839cab4170671c80d806a3f27820faf","src/ir/analysis/sizedness.rs":"17f1f2b6affd025f73853b9b5a76b3f157b5f9e563e9eaa374735fcb84c13308","src/ir/analysis/template_params.rs":"da949976a7fd04d6fc564ea6a77dfdbf4f5bf05db64687ed7a0616cba598a42d","src/ir/annotations.rs":"1c931d7bbba1e1613e9cccaab58d14f75e79b831b5c881e41f5b5257a9cbced7","src/ir/comment.rs":"31d64a49ae3d9c3c348fa2539e03306ca3a23fae429cab452e42b31ecf632145","src/ir/comp.rs":"abaa90e27dc6416f1b8db003f87888e7651d5b46c4d4526153980e5621612e54","src/ir/context.rs":"3a76458a5aa74075a60a5cd752ed59ad3943054f55b017700389f78072935215","src/ir/derive.rs":"e5581852eec87918901a129284b4965aefc8a19394187a8095779a084f28fabe","src/ir/dot.rs":"e25ff72ac174a798894c9673d81bdfb86fa9f4228b34a14ce0dc741a186a52bd","src/ir/enum_ty.rs":"e49e3c6ffc0289584e2f836fe56a4b7ebf6ca3f8b602248141d67b9f533770cc","src/ir/function.rs":"aa454ace56bda8074b2865933282aa124624310c8bc0c994d454f5799f4e88be","src/ir/int.rs":"68a86182743ec338d58e42203364dc7c8970cb7ec3550433ca92f0c9489b4442","src/ir/item.rs":"a71bdacc7419ec86d52ac534158cf4bfa4600e9cbc214c0075766700f5b053b0","src/ir/item_kind.rs":"7666a1ff1b8260978b790a08b4139ab56b5c65714a5652bbcec7faa7443adc36","src/ir/layout.rs":"755e3787c262de434a53a8c326f0e825f95415ed6b0f925c1cddf208ca8e3bc4","src/ir/mod.rs":"713cd537434567003197a123cbae679602c715e976d22f7b23dafd0826ea4c70","src/ir/module.rs":"70cf6ddfeabe6cdc13fdc767c783216c073404848d827e85fc6c2de3a19b5c3f","src/ir/objc.rs":"195fb2a3e4371b90244f3a8f295fd80cc77e0f2daf8fd27e3d8e5b78bd6b55d6","src/ir/template.rs":"44bd7214cf1e7f70e60694115082aac5b8a6c1687fff584cd08cdcfadabc5734","src/ir/traversal.rs":"5ac088277f4dfe2918d81b9294aaee41fd83db8e46def66a05f89de078bf4c49","src/ir/ty.rs":"8f2b970da76850685c4d334289af6dede7742862d7a81f2236115afaa1a92fa9","src/ir/var.rs":"86e9f19403fb9231ba60dec0a04e5b56fe28a37c7a5e6f676c978789c9d93c5a","src/lib.rs":"ed2d0aeb48b28b4a96b8e76a10e00b10cb6cc32c0a686d536f9021463b7ee0e8","src/log_stubs.rs":"6dfdd908b7c6453da416cf232893768f9480e551ca4add0858ef88bf71ee6ceb","src/main.rs":"74e582c37b146090332b1496f5b4bca02c7629d03a4ae40302cb4a723f08e445","src/options.rs":"119358b741601dafc13560856f6e4b4f78b6cd2b19067893c2672ba8f5dc6de1","src/parse.rs":"4ffc54415eadb622ee488603862788c78361ef2c889de25259441a340c2a010f","src/regex_set.rs":"6c46357fb1ee68250e5e017cbf691f340041489ae78599eee7a5665a6ddce27f","src/time.rs":"8efe317e7c6b5ba8e0865ce7b49ca775ee8a02590f4241ef62f647fa3c22b68e"},"package":"2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239"}

297
third_party/rust/bindgen/Cargo.lock сгенерированный поставляемый
Просмотреть файл

@ -2,369 +2,348 @@
# It is not intended for manual editing.
[[package]]
name = "aho-corasick"
version = "0.7.6"
version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
dependencies = [
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr",
]
[[package]]
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi",
]
[[package]]
name = "atty"
version = "0.2.13"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "bindgen"
version = "0.53.2"
version = "0.56.0"
dependencies = [
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cexpr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"clang-sys 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"which 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags",
"cexpr",
"clang-sys",
"clap",
"diff",
"env_logger",
"lazy_static",
"lazycell",
"log",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"which",
]
[[package]]
name = "bitflags"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cc"
version = "1.0.45"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "cexpr"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
dependencies = [
"nom 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"nom",
]
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clang-sys"
version = "0.29.0"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0659001ab56b791be01d4b729c44376edc6718cf389a502e579b77b758f3296c"
dependencies = [
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glob",
"libc",
"libloading",
]
[[package]]
name = "clap"
version = "2.33.0"
version = "2.33.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ansi_term",
"atty",
"bitflags",
"strsim",
"textwrap",
"unicode-width",
"vec_map",
]
[[package]]
name = "diff"
version = "0.1.11"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499"
[[package]]
name = "env_logger"
version = "0.7.0"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54532e3223c5af90a6a757c90b5c5521564b07e5e7a958681bcd2afad421cdcd"
dependencies = [
"atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
[[package]]
name = "glob"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "hermit-abi"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
dependencies = [
"libc",
]
[[package]]
name = "humantime"
version = "1.3.0"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a"
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "lazycell"
version = "1.2.1"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.66"
version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
[[package]]
name = "libloading"
version = "0.5.2"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1090080fe06ec2648d0da3881d9453d97e71a45f00eb179af7fdd7e3f686fdb0"
dependencies = [
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 1.0.0",
"winapi",
]
[[package]]
name = "log"
version = "0.4.8"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.10",
]
[[package]]
name = "memchr"
version = "2.2.1"
version = "2.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
[[package]]
name = "nom"
version = "5.1.1"
version = "5.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
dependencies = [
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr",
"version_check",
]
[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "proc-macro2"
version = "1.0.4"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid",
]
[[package]]
name = "quick-error"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "quote"
version = "1.0.2"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
dependencies = [
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2",
]
[[package]]
name = "regex"
version = "1.3.1"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c"
dependencies = [
"aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"aho-corasick",
"memchr",
"regex-syntax",
"thread_local",
]
[[package]]
name = "regex-syntax"
version = "0.6.12"
version = "0.6.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189"
[[package]]
name = "rustc-hash"
version = "1.0.1"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "shlex"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "termcolor"
version = "1.0.5"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
dependencies = [
"wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-util",
]
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width",
]
[[package]]
name = "thread_local"
version = "0.3.6"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static",
]
[[package]]
name = "unicode-width"
version = "0.1.6"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]]
name = "unicode-xid"
version = "0.2.0"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]]
name = "vec_map"
version = "0.8.1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
version = "0.9.1"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
[[package]]
name = "which"
version = "3.0.0"
version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
dependencies = [
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"libc",
]
[[package]]
name = "winapi"
version = "0.3.8"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.2"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wincolor"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[metadata]
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
"checksum bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
"checksum cexpr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum clang-sys 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03542fa2ed0accba4a5c84ec031f09a20b725e7ba1b1c9b79f1feb4aa17d0c07"
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
"checksum env_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "39ecdb7dd54465526f0a56d666e3b2dd5f3a218665a030b6e4ad9e70fa95d8fa"
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum nom 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b471253da97532da4b61552249c521e01e736071f71c1a4f7ebbfbf0a06aad6"
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
"checksum proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afdc77cc74ec70ed262262942ebb7dac3d479e9e5cfa2da1841c0806f6cdabcc"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd"
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8"
"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e"
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
"checksum which 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "240a31163872f7e8e49f35b42b58485e35355b07eb009d9f3686733541339a69"
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

11
third_party/rust/bindgen/Cargo.toml поставляемый
Просмотреть файл

@ -11,8 +11,9 @@
# will likely look very different (and much more reasonable)
[package]
edition = "2018"
name = "bindgen"
version = "0.53.2"
version = "0.56.0"
authors = ["Jyun-Yan You <jyyou.tw@gmail.com>", "Emilio Cobos Álvarez <emilio@crisal.io>", "Nick Fitzgerald <fitzgen@gmail.com>", "The Servo project developers"]
build = "build.rs"
include = ["LICENSE", "README.md", "Cargo.toml", "build.rs", "src/*.rs", "src/**/*.rs"]
@ -39,11 +40,8 @@ version = "1.0.3"
[dependencies.cexpr]
version = "0.4"
[dependencies.cfg-if]
version = "0.1.0"
[dependencies.clang-sys]
version = "0.29"
version = "1"
features = ["clang_6_0"]
[dependencies.clap]
@ -51,7 +49,7 @@ version = "2"
optional = true
[dependencies.env_logger]
version = "0.7"
version = "0.8"
optional = true
[dependencies.lazy_static]
@ -106,7 +104,6 @@ runtime = ["clang-sys/runtime"]
static = ["clang-sys/static"]
testing_only_docs = []
testing_only_extra_assertions = []
testing_only_libclang_3_8 = []
testing_only_libclang_3_9 = []
testing_only_libclang_4 = []
testing_only_libclang_5 = []

35
third_party/rust/bindgen/README.md поставляемый
Просмотреть файл

@ -20,7 +20,7 @@ void eleven_out_of_ten_majestic_af(Doggo* pupper);
functions and use its types:
```rust
/* automatically generated by rust-bindgen */
/* automatically generated by rust-bindgen 0.99.9 */
#[repr(C)]
pub struct Doggo {
@ -37,10 +37,43 @@ extern "C" {
[📚 Read the `bindgen` users guide here! 📚](https://rust-lang.github.io/rust-bindgen)
## MSRV
The minimum supported Rust version is **1.40**.
No MSRV bump policy has been established yet, so MSRV may increase in any release.
## API Reference
[API reference documentation is on docs.rs](https://docs.rs/bindgen)
## Environment Variables
In addition to the [library API](https://docs.rs/bindgen) and [executable command-line API][bindgen-cmdline],
`bindgen` can be controlled through environment variables.
End-users should set these environment variables to modify `bindgen`'s behavior without modifying the source code of direct consumers of `bindgen`.
- `BINDGEN_EXTRA_CLANG_ARGS`: extra arguments to pass to `clang`
- Arguments are whitespace-separated
- Use shell-style quoting to pass through whitespace
- Examples:
- Specify alternate sysroot: `--sysroot=/path/to/sysroot`
- Add include search path with spaces: `-I"/path/with spaces"`
Additionally, `bindgen` uses `libclang` to parse C and C++ header files.
To modify how `bindgen` searches for `libclang`, see the [`clang-sys` documentation][clang-sys-env].
For more details on how `bindgen` uses `libclang`, see the [`bindgen` users guide][bindgen-book-clang].
## Releases
We don't follow a specific release calendar, but if you need a release please
file an issue requesting that (ping `@emilio` for increased effectiveness).
## Contributing
[See `CONTRIBUTING.md` for hacking on `bindgen`!](./CONTRIBUTING.md)
[bindgen-cmdline]: https://rust-lang.github.io/rust-bindgen/command-line-usage.html
[clang-sys-env]: https://github.com/KyleMayes/clang-sys#environment-variables
[bindgen-book-clang]: https://rust-lang.github.io/rust-bindgen/requirements.html#clang

8
third_party/rust/bindgen/build.rs поставляемый
Просмотреть файл

@ -71,4 +71,12 @@ mod testgen {
fn main() {
target::main();
testgen::main();
// On behalf of clang_sys, rebuild ourselves if important configuration
// variables change, to ensure that bindings get rebuilt if the
// underlying libclang changes.
println!("cargo:rerun-if-env-changed=LLVM_CONFIG_PATH");
println!("cargo:rerun-if-env-changed=LIBCLANG_PATH");
println!("cargo:rerun-if-env-changed=LIBCLANG_STATIC_PATH");
println!("cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS");
}

15
third_party/rust/bindgen/src/callbacks.rs поставляемый
Просмотреть файл

@ -1,7 +1,7 @@
//! A public API for more fine-grained customization of bindgen behavior.
pub use ir::enum_ty::{EnumVariantCustomBehavior, EnumVariantValue};
pub use ir::int::IntKind;
pub use crate::ir::enum_ty::{EnumVariantCustomBehavior, EnumVariantValue};
pub use crate::ir::int::IntKind;
use std::fmt;
use std::panic::UnwindSafe;
@ -35,10 +35,19 @@ pub trait ParseCallbacks: fmt::Debug + UnwindSafe {
None
}
/// This will be run on every string macro. The callback can not influence the further
/// This will be run on every string macro. The callback cannot influence the further
/// treatment of the macro, but may use the value to generate additional code or configuration.
fn str_macro(&self, _name: &str, _value: &[u8]) {}
/// This will be run on every function-like macro. The callback cannot
/// influence the further treatment of the macro, but may use the value to
/// generate additional code or configuration.
///
/// The first parameter represents the name and argument list (including the
/// parentheses) of the function-like macro. The second parameter represents
/// the expansion of the macro as a sequence of tokens.
fn func_macro(&self, _name: &str, _value: &[&[u8]]) {}
/// This function should return whether, given an enum variant
/// name, and value, this enum variant will forcibly be a constant.
fn enum_variant_behavior(

149
third_party/rust/bindgen/src/clang.rs поставляемый
Просмотреть файл

@ -3,10 +3,9 @@
#![allow(non_upper_case_globals, dead_code)]
use crate::ir::context::BindgenContext;
use cexpr;
use clang_sys::*;
use ir::context::BindgenContext;
use regex;
use std::ffi::{CStr, CString};
use std::fmt;
@ -70,20 +69,13 @@ impl Cursor {
/// Get the mangled name of this cursor's referent.
pub fn mangling(&self) -> String {
if clang_Cursor_getMangling::is_loaded() {
unsafe { cxstring_into_string(clang_Cursor_getMangling(self.x)) }
} else {
self.spelling()
}
unsafe { cxstring_into_string(clang_Cursor_getMangling(self.x)) }
}
/// Gets the C++ manglings for this cursor, or an error if the function is
/// not loaded or the manglings are not available.
/// Gets the C++ manglings for this cursor, or an error if the manglings
/// are not available.
pub fn cxx_manglings(&self) -> Result<Vec<String>, ()> {
use clang_sys::*;
if !clang_Cursor_getCXXManglings::is_loaded() {
return Err(());
}
unsafe {
let manglings = clang_Cursor_getCXXManglings(self.x);
if manglings.is_null() {
@ -239,6 +231,11 @@ impl Cursor {
}
}
/// Is this Cursor pointing to a function-like macro definition?
pub fn is_macro_function_like(&self) -> bool {
unsafe { clang_Cursor_isMacroFunctionLike(self.x) != 0 }
}
/// Get the kind of referent this cursor is pointing to.
pub fn kind(&self) -> CXCursorKind {
self.x.kind
@ -469,8 +466,7 @@ impl Cursor {
/// Is the referent an inlined function?
pub fn is_inlined_function(&self) -> bool {
clang_Cursor_isFunctionInlined::is_loaded() &&
unsafe { clang_Cursor_isFunctionInlined(self.x) != 0 }
unsafe { clang_Cursor_isFunctionInlined(self.x) != 0 }
}
/// Get the width of this cursor's referent bit field, or `None` if the
@ -501,6 +497,19 @@ impl Cursor {
}
}
/// Get the boolean constant value for this cursor's enum variant referent.
///
/// Returns None if the cursor's referent is not an enum variant.
pub fn enum_val_boolean(&self) -> Option<bool> {
unsafe {
if self.kind() == CXCursor_EnumConstantDecl {
Some(clang_getEnumConstantDeclValue(self.x) != 0)
} else {
None
}
}
}
/// Get the signed constant value for this cursor's enum variant referent.
///
/// Returns None if the cursor's referent is not an enum variant.
@ -581,11 +590,7 @@ impl Cursor {
/// Get the visibility of this cursor's referent.
pub fn visibility(&self) -> CXVisibilityKind {
if clang_getCursorVisibility::is_loaded() {
unsafe { clang_getCursorVisibility(self.x) }
} else {
CXVisibility_Default
}
unsafe { clang_getCursorVisibility(self.x) }
}
/// Given that this cursor's referent is a function, return cursors to its
@ -630,16 +635,11 @@ impl Cursor {
/// Is this cursor's referent a field declaration that is marked as
/// `mutable`?
pub fn is_mutable_field(&self) -> bool {
clang_CXXField_isMutable::is_loaded() &&
unsafe { clang_CXXField_isMutable(self.x) != 0 }
unsafe { clang_CXXField_isMutable(self.x) != 0 }
}
/// Get the offset of the field represented by the Cursor.
pub fn offset_of_field(&self) -> Result<usize, LayoutError> {
if !clang_Cursor_getOffsetOfField::is_loaded() {
return Err(LayoutError::from(-1));
}
let offset = unsafe { clang_Cursor_getOffsetOfField(self.x) };
if offset < 0 {
@ -698,30 +698,9 @@ impl Cursor {
/// Gets the tokens that correspond to that cursor as `cexpr` tokens.
pub fn cexpr_tokens(self) -> Vec<cexpr::token::Token> {
use cexpr::token;
self.tokens()
.iter()
.filter_map(|token| {
let kind = match token.kind {
CXToken_Punctuation => token::Kind::Punctuation,
CXToken_Literal => token::Kind::Literal,
CXToken_Identifier => token::Kind::Identifier,
CXToken_Keyword => token::Kind::Keyword,
// NB: cexpr is not too happy about comments inside
// expressions, so we strip them down here.
CXToken_Comment => return None,
_ => {
error!("Found unexpected token kind: {:?}", token);
return None;
}
};
Some(token::Token {
kind,
raw: token.spelling().to_vec().into_boxed_slice(),
})
})
.filter_map(|token| token.as_cexpr_token())
.collect()
}
@ -793,13 +772,16 @@ impl<'a> Drop for RawTokens<'a> {
}
}
/// A raw clang token, that exposes only the kind and spelling. This is a
/// A raw clang token, that exposes only kind, spelling, and extent. This is a
/// slightly more convenient version of `CXToken` which owns the spelling
/// string.
/// string and extent.
#[derive(Debug)]
pub struct ClangToken {
spelling: CXString,
/// The kind of token, this is the same as the relevant member from
/// The extent of the token. This is the same as the relevant member from
/// `CXToken`.
pub extent: CXSourceRange,
/// The kind of the token. This is the same as the relevant member from
/// `CXToken`.
pub kind: CXTokenKind,
}
@ -812,6 +794,30 @@ impl ClangToken {
};
c_str.to_bytes()
}
/// Converts a ClangToken to a `cexpr` token if possible.
pub fn as_cexpr_token(&self) -> Option<cexpr::token::Token> {
use cexpr::token;
let kind = match self.kind {
CXToken_Punctuation => token::Kind::Punctuation,
CXToken_Literal => token::Kind::Literal,
CXToken_Identifier => token::Kind::Identifier,
CXToken_Keyword => token::Kind::Keyword,
// NB: cexpr is not too happy about comments inside
// expressions, so we strip them down here.
CXToken_Comment => return None,
_ => {
warn!("Found unexpected token kind: {:?}", self);
return None;
}
};
Some(token::Token {
kind,
raw: self.spelling().to_vec().into_boxed_slice(),
})
}
}
impl Drop for ClangToken {
@ -834,7 +840,12 @@ impl<'a> Iterator for ClangTokenIterator<'a> {
unsafe {
let kind = clang_getTokenKind(*raw);
let spelling = clang_getTokenSpelling(self.tu, *raw);
Some(ClangToken { kind, spelling })
let extent = clang_getTokenExtent(self.tu, *raw);
Some(ClangToken {
kind,
extent,
spelling,
})
}
}
}
@ -1085,8 +1096,8 @@ impl Type {
pub fn fallible_layout(
&self,
ctx: &BindgenContext,
) -> Result<::ir::layout::Layout, LayoutError> {
use ir::layout::Layout;
) -> Result<crate::ir::layout::Layout, LayoutError> {
use crate::ir::layout::Layout;
let size = self.fallible_size(ctx)?;
let align = self.fallible_align(ctx)?;
Ok(Layout::new(size, align))
@ -1095,13 +1106,6 @@ impl Type {
/// Get the number of template arguments this type has, or `None` if it is
/// not some kind of template.
pub fn num_template_args(&self) -> Option<u32> {
// If an old libclang is loaded, we have no hope of answering this
// question correctly. However, that's no reason to panic when
// generating bindings for simple C headers with an old libclang.
if !clang_Type_getNumTemplateArguments::is_loaded() {
return None;
}
let n = unsafe { clang_Type_getNumTemplateArguments(self.x) };
if n >= 0 {
Some(n as u32)
@ -1231,11 +1235,7 @@ impl Type {
pub fn named(&self) -> Type {
unsafe {
Type {
x: if clang_Type_getNamedType::is_loaded() {
clang_Type_getNamedType(self.x)
} else {
self.x
},
x: clang_Type_getNamedType(self.x),
}
}
}
@ -1540,15 +1540,6 @@ impl Drop for Index {
}
}
/// A token emitted by clang's lexer.
#[derive(Debug)]
pub struct Token {
/// The kind of token this is.
pub kind: CXTokenKind,
/// A display name for this token.
pub spelling: String,
}
/// A translation unit (or "compilation unit").
pub struct TranslationUnit {
x: CXTranslationUnit,
@ -1854,11 +1845,7 @@ pub fn ast_dump(c: &Cursor, depth: isize) -> CXChildVisitResult {
format!(" {}spelling = \"{}\"", prefix, ty.spelling()),
);
let num_template_args =
if clang_Type_getNumTemplateArguments::is_loaded() {
unsafe { clang_Type_getNumTemplateArguments(ty.x) }
} else {
-1
};
unsafe { clang_Type_getNumTemplateArguments(ty.x) };
if num_template_args >= 0 {
print_indent(
depth,
@ -1955,10 +1942,6 @@ pub struct EvalResult {
impl EvalResult {
/// Evaluate `cursor` and return the result.
pub fn new(cursor: Cursor) -> Option<Self> {
if !clang_Cursor_Evaluate::is_loaded() {
return None;
}
// Work around https://bugs.llvm.org/show_bug.cgi?id=42532, see:
// * https://github.com/rust-lang/rust-bindgen/issues/283
// * https://github.com/rust-lang/rust-bindgen/issues/1590

145
third_party/rust/bindgen/src/codegen/dyngen.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,145 @@
use crate::ir::function::Abi;
use proc_macro2::Ident;
/// Used to build the output tokens for dynamic bindings.
#[derive(Default)]
pub struct DynamicItems {
/// Tracks the tokens that will appears inside the library struct -- e.g.:
/// ```ignore
/// struct Lib {
/// __library: ::libloading::Library,
/// pub x: Result<unsafe extern ..., ::libloading::Error>, // <- tracks these
/// ...
/// }
/// ```
struct_members: Vec<proc_macro2::TokenStream>,
/// Tracks the tokens that will appear inside the library struct's implementation, e.g.:
///
/// ```ignore
/// impl Lib {
/// ...
/// pub unsafe fn foo(&self, ...) { // <- tracks these
/// ...
/// }
/// }
/// ```
struct_implementation: Vec<proc_macro2::TokenStream>,
/// Tracks the initialization of the fields inside the `::new` constructor of the library
/// struct, e.g.:
/// ```ignore
/// impl Lib {
///
/// pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
/// where
/// P: AsRef<::std::ffi::OsStr>,
/// {
/// ...
/// let foo = __library.get(...) ...; // <- tracks these
/// ...
/// }
///
/// ...
/// }
/// ```
constructor_inits: Vec<proc_macro2::TokenStream>,
/// Tracks the information that is passed to the library struct at the end of the `::new`
/// constructor, e.g.:
/// ```ignore
/// impl LibFoo {
/// pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
/// where
/// P: AsRef<::std::ffi::OsStr>,
/// {
/// ...
/// Ok(LibFoo {
/// __library: __library,
/// foo,
/// bar, // <- tracks these
/// ...
/// })
/// }
/// }
/// ```
init_fields: Vec<proc_macro2::TokenStream>,
}
impl DynamicItems {
pub fn new() -> Self {
Self::default()
}
pub fn get_tokens(&self, lib_ident: Ident) -> proc_macro2::TokenStream {
let struct_members = &self.struct_members;
let constructor_inits = &self.constructor_inits;
let init_fields = &self.init_fields;
let struct_implementation = &self.struct_implementation;
quote! {
extern crate libloading;
pub struct #lib_ident {
__library: ::libloading::Library,
#(#struct_members)*
}
impl #lib_ident {
pub unsafe fn new<P>(
path: P
) -> Result<Self, ::libloading::Error>
where P: AsRef<::std::ffi::OsStr> {
let __library = ::libloading::Library::new(path)?;
#( #constructor_inits )*
Ok(
#lib_ident {
__library,
#( #init_fields ),*
}
)
}
#( #struct_implementation )*
}
}
}
pub fn push(
&mut self,
ident: Ident,
abi: Abi,
is_variadic: bool,
args: Vec<proc_macro2::TokenStream>,
args_identifiers: Vec<proc_macro2::TokenStream>,
ret: proc_macro2::TokenStream,
ret_ty: proc_macro2::TokenStream,
) {
if !is_variadic {
assert_eq!(args.len(), args_identifiers.len());
}
self.struct_members.push(quote! {
pub #ident: Result<unsafe extern #abi fn ( #( #args ),* ) #ret, ::libloading::Error>,
});
// We can't implement variadic functions from C easily, so we allow to
// access the function pointer so that the user can call it just fine.
if !is_variadic {
self.struct_implementation.push(quote! {
pub unsafe fn #ident ( &self, #( #args ),* ) -> #ret_ty {
let sym = self.#ident.as_ref().expect("Expected function, got error.");
(sym)(#( #args_identifiers ),*)
}
});
}
let ident_str = ident.to_string();
self.constructor_inits.push(quote! {
let #ident = __library.get(#ident_str.as_bytes()).map(|sym| *sym);
});
self.init_fields.push(quote! {
#ident
});
}
}

Просмотреть файл

@ -1,7 +1,7 @@
//! Helpers for code generation that don't need macro expansion.
use ir::context::BindgenContext;
use ir::layout::Layout;
use crate::ir::context::BindgenContext;
use crate::ir::layout::Layout;
use proc_macro2::{Ident, Span, TokenStream};
use quote::TokenStreamExt;
@ -136,10 +136,10 @@ pub fn bitfield_unit(ctx: &BindgenContext, layout: Layout) -> TokenStream {
}
pub mod ast_ty {
use ir::context::BindgenContext;
use ir::function::FunctionSig;
use ir::layout::Layout;
use ir::ty::FloatKind;
use crate::ir::context::BindgenContext;
use crate::ir::function::FunctionSig;
use crate::ir::layout::Layout;
use crate::ir::ty::FloatKind;
use proc_macro2::{self, TokenStream};
use std::str::FromStr;

Просмотреть файл

@ -1,7 +1,7 @@
use ir::comp::{BitfieldUnit, CompKind, Field, FieldData, FieldMethods};
use ir::context::BindgenContext;
use ir::item::{HasTypeParamInArray, IsOpaque, Item, ItemCanonicalName};
use ir::ty::{TypeKind, RUST_DERIVE_IN_ARRAY_LIMIT};
use crate::ir::comp::{BitfieldUnit, CompKind, Field, FieldData, FieldMethods};
use crate::ir::context::BindgenContext;
use crate::ir::item::{HasTypeParamInArray, IsOpaque, Item, ItemCanonicalName};
use crate::ir::ty::{TypeKind, RUST_DERIVE_IN_ARRAY_LIMIT};
use proc_macro2;
pub fn gen_debug_impl(

Просмотреть файл

@ -1,7 +1,7 @@
use ir::comp::{CompInfo, CompKind, Field, FieldMethods};
use ir::context::BindgenContext;
use ir::item::{IsOpaque, Item};
use ir::ty::{TypeKind, RUST_DERIVE_IN_ARRAY_LIMIT};
use crate::ir::comp::{CompInfo, CompKind, Field, FieldMethods};
use crate::ir::context::BindgenContext;
use crate::ir::item::{IsOpaque, Item};
use crate::ir::ty::{TypeKind, RUST_DERIVE_IN_ARRAY_LIMIT};
use proc_macro2;
/// Generate a manual implementation of `PartialEq` trait for the

649
third_party/rust/bindgen/src/codegen/mod.rs поставляемый
Просмотреть файл

@ -1,3 +1,4 @@
mod dyngen;
mod error;
mod helpers;
mod impl_debug;
@ -10,41 +11,43 @@ pub(crate) mod bitfield_unit;
#[cfg(all(test, target_endian = "little"))]
mod bitfield_unit_tests;
use self::dyngen::DynamicItems;
use self::helpers::attributes;
use self::struct_layout::StructLayoutTracker;
use super::BindgenOptions;
use ir::analysis::{HasVtable, Sizedness};
use ir::annotations::FieldAccessorKind;
use ir::comment;
use ir::comp::{
use crate::ir::analysis::{HasVtable, Sizedness};
use crate::ir::annotations::FieldAccessorKind;
use crate::ir::comment;
use crate::ir::comp::{
Base, Bitfield, BitfieldUnit, CompInfo, CompKind, Field, FieldData,
FieldMethods, Method, MethodKind,
};
use ir::context::{BindgenContext, ItemId};
use ir::derive::{
use crate::ir::context::{BindgenContext, ItemId};
use crate::ir::derive::{
CanDerive, CanDeriveCopy, CanDeriveDebug, CanDeriveDefault, CanDeriveEq,
CanDeriveHash, CanDeriveOrd, CanDerivePartialEq, CanDerivePartialOrd,
};
use ir::dot;
use ir::enum_ty::{Enum, EnumVariant, EnumVariantValue};
use ir::function::{Abi, Function, FunctionKind, FunctionSig, Linkage};
use ir::int::IntKind;
use ir::item::{IsOpaque, Item, ItemCanonicalName, ItemCanonicalPath};
use ir::item_kind::ItemKind;
use ir::layout::Layout;
use ir::module::Module;
use ir::objc::{ObjCInterface, ObjCMethod};
use ir::template::{
use crate::ir::dot;
use crate::ir::enum_ty::{Enum, EnumVariant, EnumVariantValue};
use crate::ir::function::{Abi, Function, FunctionKind, FunctionSig, Linkage};
use crate::ir::int::IntKind;
use crate::ir::item::{IsOpaque, Item, ItemCanonicalName, ItemCanonicalPath};
use crate::ir::item_kind::ItemKind;
use crate::ir::layout::Layout;
use crate::ir::module::Module;
use crate::ir::objc::{ObjCInterface, ObjCMethod};
use crate::ir::template::{
AsTemplateParam, TemplateInstantiation, TemplateParameters,
};
use ir::ty::{Type, TypeKind};
use ir::var::Var;
use crate::ir::ty::{Type, TypeKind};
use crate::ir::var::Var;
use proc_macro2::{self, Ident, Span};
use quote::TokenStreamExt;
use crate::{Entry, HashMap, HashSet};
use std;
use std::borrow::Cow;
use std::cell::Cell;
@ -53,7 +56,6 @@ use std::fmt::Write;
use std::iter;
use std::ops;
use std::str::FromStr;
use {Entry, HashMap, HashSet};
// Name of type defined in constified enum module
pub static CONSTIFIED_ENUM_MODULE_REPR_NAME: &'static str = "Type";
@ -95,8 +97,96 @@ fn root_import(
}
}
bitflags! {
struct DerivableTraits: u16 {
const DEBUG = 1 << 0;
const DEFAULT = 1 << 1;
const COPY = 1 << 2;
const CLONE = 1 << 3;
const HASH = 1 << 4;
const PARTIAL_ORD = 1 << 5;
const ORD = 1 << 6;
const PARTIAL_EQ = 1 << 7;
const EQ = 1 << 8;
}
}
fn derives_of_item(item: &Item, ctx: &BindgenContext) -> DerivableTraits {
let mut derivable_traits = DerivableTraits::empty();
if item.can_derive_debug(ctx) && !item.annotations().disallow_debug() {
derivable_traits |= DerivableTraits::DEBUG;
}
if item.can_derive_default(ctx) && !item.annotations().disallow_default() {
derivable_traits |= DerivableTraits::DEFAULT;
}
let all_template_params = item.all_template_params(ctx);
if item.can_derive_copy(ctx) && !item.annotations().disallow_copy() {
derivable_traits |= DerivableTraits::COPY;
if ctx.options().rust_features().builtin_clone_impls ||
!all_template_params.is_empty()
{
// FIXME: This requires extra logic if you have a big array in a
// templated struct. The reason for this is that the magic:
// fn clone(&self) -> Self { *self }
// doesn't work for templates.
//
// It's not hard to fix though.
derivable_traits |= DerivableTraits::CLONE;
}
}
if item.can_derive_hash(ctx) {
derivable_traits |= DerivableTraits::HASH;
}
if item.can_derive_partialord(ctx) {
derivable_traits |= DerivableTraits::PARTIAL_ORD;
}
if item.can_derive_ord(ctx) {
derivable_traits |= DerivableTraits::ORD;
}
if item.can_derive_partialeq(ctx) {
derivable_traits |= DerivableTraits::PARTIAL_EQ;
}
if item.can_derive_eq(ctx) {
derivable_traits |= DerivableTraits::EQ;
}
derivable_traits
}
impl From<DerivableTraits> for Vec<&'static str> {
fn from(derivable_traits: DerivableTraits) -> Vec<&'static str> {
[
(DerivableTraits::DEBUG, "Debug"),
(DerivableTraits::DEFAULT, "Default"),
(DerivableTraits::COPY, "Copy"),
(DerivableTraits::CLONE, "Clone"),
(DerivableTraits::HASH, "Hash"),
(DerivableTraits::PARTIAL_ORD, "PartialOrd"),
(DerivableTraits::ORD, "Ord"),
(DerivableTraits::PARTIAL_EQ, "PartialEq"),
(DerivableTraits::EQ, "Eq"),
]
.iter()
.filter_map(|&(flag, derive)| {
Some(derive).filter(|_| derivable_traits.contains(flag))
})
.collect()
}
}
struct CodegenResult<'a> {
items: Vec<proc_macro2::TokenStream>,
dynamic_items: DynamicItems,
/// A monotonic counter used to add stable unique id's to stuff that doesn't
/// need to be referenced by anything.
@ -147,12 +237,13 @@ impl<'a> CodegenResult<'a> {
fn new(codegen_id: &'a Cell<usize>) -> Self {
CodegenResult {
items: vec![],
dynamic_items: DynamicItems::new(),
saw_bindgen_union: false,
saw_incomplete_array: false,
saw_objc: false,
saw_block: false,
saw_bitfield_unit: false,
codegen_id: codegen_id,
codegen_id,
items_seen: Default::default(),
functions_seen: Default::default(),
vars_seen: Default::default(),
@ -160,6 +251,10 @@ impl<'a> CodegenResult<'a> {
}
}
fn dynamic_items(&mut self) -> &mut DynamicItems {
&mut self.dynamic_items
}
fn saw_bindgen_union(&mut self) {
self.saw_bindgen_union = true;
}
@ -362,7 +457,7 @@ impl CodeGenerator for Item {
// TODO(emilio, #453): Figure out what to do when this happens
// legitimately, we could track the opaque stuff and disable the
// assertion there I guess.
error!("Found non-whitelisted item in code generation: {:?}", self);
warn!("Found non-whitelisted item in code generation: {:?}", self);
}
result.set_seen(self.id());
@ -483,7 +578,7 @@ impl CodeGenerator for Var {
result: &mut CodegenResult<'a>,
item: &Item,
) {
use ir::var::VarType;
use crate::ir::var::VarType;
debug!("<Var as CodeGenerator>::codegen: item = {:?}", item);
debug_assert!(item.is_enabled_for_codegen(ctx));
@ -793,8 +888,17 @@ impl CodeGenerator for Type {
"repr_transparent feature is required to use {:?}",
alias_style
);
let mut attributes =
vec![attributes::repr("transparent")];
let derivable_traits = derives_of_item(item, ctx);
if !derivable_traits.is_empty() {
let derives: Vec<_> = derivable_traits.into();
attributes.push(attributes::derives(&derives))
}
quote! {
#[repr(transparent)]
#( #attributes )*
pub struct #rust_name
}
}
@ -891,9 +995,9 @@ impl<'a> Vtable<'a> {
base_classes: &'a [Base],
) -> Self {
Vtable {
item_id: item_id,
methods: methods,
base_classes: base_classes,
item_id,
methods,
base_classes,
}
}
}
@ -1310,7 +1414,7 @@ impl<'a> FieldCodegen<'a> for BitfieldUnit {
F: Extend<proc_macro2::TokenStream>,
M: Extend<proc_macro2::TokenStream>,
{
use ir::ty::RUST_DERIVE_IN_ARRAY_LIMIT;
use crate::ir::ty::RUST_DERIVE_IN_ARRAY_LIMIT;
result.saw_bitfield_unit();
@ -1787,66 +1891,37 @@ impl CodeGenerator for CompInfo {
}
}
let mut derives = vec![];
if item.can_derive_debug(ctx) {
derives.push("Debug");
} else {
needs_debug_impl =
ctx.options().derive_debug && ctx.options().impl_debug
let derivable_traits = derives_of_item(item, ctx);
if !derivable_traits.contains(DerivableTraits::DEBUG) {
needs_debug_impl = ctx.options().derive_debug &&
ctx.options().impl_debug &&
!ctx.no_debug_by_name(item) &&
!item.annotations().disallow_debug();
}
if item.can_derive_default(ctx) {
derives.push("Default");
} else {
needs_default_impl =
ctx.options().derive_default && !self.is_forward_declaration();
if !derivable_traits.contains(DerivableTraits::DEFAULT) {
needs_default_impl = ctx.options().derive_default &&
!self.is_forward_declaration() &&
!ctx.no_default_by_name(item) &&
!item.annotations().disallow_default();
}
let all_template_params = item.all_template_params(ctx);
if item.can_derive_copy(ctx) && !item.annotations().disallow_copy() {
derives.push("Copy");
if ctx.options().rust_features().builtin_clone_impls ||
!all_template_params.is_empty()
{
// FIXME: This requires extra logic if you have a big array in a
// templated struct. The reason for this is that the magic:
// fn clone(&self) -> Self { *self }
// doesn't work for templates.
//
// It's not hard to fix though.
derives.push("Clone");
} else {
needs_clone_impl = true;
}
if derivable_traits.contains(DerivableTraits::COPY) &&
!derivable_traits.contains(DerivableTraits::CLONE)
{
needs_clone_impl = true;
}
if item.can_derive_hash(ctx) {
derives.push("Hash");
}
if item.can_derive_partialord(ctx) {
derives.push("PartialOrd");
}
if item.can_derive_ord(ctx) {
derives.push("Ord");
}
if item.can_derive_partialeq(ctx) {
derives.push("PartialEq");
} else {
if !derivable_traits.contains(DerivableTraits::PARTIAL_EQ) {
needs_partialeq_impl = ctx.options().derive_partialeq &&
ctx.options().impl_partialeq &&
ctx.lookup_can_derive_partialeq_or_partialord(item.id()) ==
CanDerive::Manually;
}
if item.can_derive_eq(ctx) {
derives.push("Eq");
}
let mut derives: Vec<_> = derivable_traits.into();
derives.extend(item.annotations().derives().iter().map(String::as_str));
if !derives.is_empty() {
@ -2146,6 +2221,10 @@ impl MethodCodegen for Method {
// First of all, output the actual function.
let function_item = ctx.resolve_item(self.signature());
if function_item.is_blacklisted(ctx) {
// We shouldn't emit a method declaration if the function is blacklisted
return;
}
function_item.codegen(ctx, result, &());
let function = function_item.expect_function();
@ -2285,7 +2364,9 @@ impl MethodCodegen for Method {
/// A helper type that represents different enum variations.
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum EnumVariation {
/// The code for this enum will use a Rust enum
/// The code for this enum will use a Rust enum. Note that creating this in unsafe code
/// (including FFI) with an invalid value will invoke undefined behaviour, whether or not
/// its marked as non_exhaustive.
Rust {
/// Indicates whether the generated struct should be `#[non_exhaustive]`
non_exhaustive: bool,
@ -2369,6 +2450,7 @@ enum EnumBuilder<'a> {
is_bitfield: bool,
},
Consts {
repr: proc_macro2::TokenStream,
variants: Vec<proc_macro2::TokenStream>,
codegen_depth: usize,
},
@ -2390,6 +2472,14 @@ impl<'a> EnumBuilder<'a> {
}
}
/// Returns true if the builder is for a rustified enum.
fn is_rust_enum(&self) -> bool {
match *self {
EnumBuilder::Rust { .. } => true,
_ => false,
}
}
/// Create a new enum given an item builder, a canonical name, a name for
/// the representation, and which variation it should be generated as.
fn new(
@ -2423,13 +2513,20 @@ impl<'a> EnumBuilder<'a> {
}
}
EnumVariation::Consts => EnumBuilder::Consts {
variants: vec![quote! {
EnumVariation::Consts => {
let mut variants = Vec::new();
variants.push(quote! {
#( #attrs )*
pub type #ident = #repr;
}],
codegen_depth: enum_codegen_depth,
},
});
EnumBuilder::Consts {
repr,
variants,
codegen_depth: enum_codegen_depth,
}
}
EnumVariation::ModuleConsts => {
let ident = Ident::new(
@ -2461,7 +2558,12 @@ impl<'a> EnumBuilder<'a> {
is_ty_named: bool,
) -> Self {
let variant_name = ctx.rust_mangle(variant.name());
let is_rust_enum = self.is_rust_enum();
let expr = match variant.val() {
EnumVariantValue::Boolean(v) if is_rust_enum => {
helpers::ast_ty::uint_expr(v as u64)
}
EnumVariantValue::Boolean(v) => quote!(#v),
EnumVariantValue::Signed(v) => helpers::ast_ty::int_expr(v),
EnumVariantValue::Unsigned(v) => helpers::ast_ty::uint_expr(v),
};
@ -2524,7 +2626,7 @@ impl<'a> EnumBuilder<'a> {
self
}
EnumBuilder::Consts { .. } => {
EnumBuilder::Consts { ref repr, .. } => {
let constant_name = match mangling_prefix {
Some(prefix) => {
Cow::Owned(format!("{}_{}", prefix, variant_name))
@ -2532,10 +2634,12 @@ impl<'a> EnumBuilder<'a> {
None => variant_name,
};
let ty = if is_ty_named { &rust_ty } else { repr };
let ident = ctx.rust_ident(constant_name);
result.push(quote! {
#doc
pub const #ident : #rust_ty = #expr ;
pub const #ident : #ty = #expr ;
});
self
@ -2746,17 +2850,17 @@ impl CodeGenerator for Enum {
}
if !variation.is_const() {
let mut derives =
vec!["Debug", "Copy", "Clone", "PartialEq", "Eq", "Hash"];
if item.can_derive_partialord(ctx) {
derives.push("PartialOrd");
}
if item.can_derive_ord(ctx) {
derives.push("Ord");
}
let mut derives = derives_of_item(item, ctx);
// For backwards compat, enums always derive Clone/Eq/PartialEq/Hash, even
// if we don't generate those by default.
derives.insert(
DerivableTraits::CLONE |
DerivableTraits::COPY |
DerivableTraits::HASH |
DerivableTraits::PARTIAL_EQ |
DerivableTraits::EQ,
);
let derives: Vec<_> = derives.into();
attrs.push(attributes::derives(&derives));
}
@ -2790,9 +2894,12 @@ impl CodeGenerator for Enum {
});
}
let repr = {
let repr_name = ctx.rust_ident_raw(repr_name);
quote! { #repr_name }
let repr = match self.repr() {
Some(ty) => ty.to_rust_ty_or_opaque(ctx, &()),
None => {
let repr_name = ctx.rust_ident_raw(repr_name);
quote! { #repr_name }
}
};
let mut builder = EnumBuilder::new(
@ -2947,6 +3054,50 @@ impl CodeGenerator for Enum {
}
}
/// Enum for the default type of macro constants.
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum MacroTypeVariation {
/// Use i32 or i64
Signed,
/// Use u32 or u64
Unsigned,
}
impl MacroTypeVariation {
/// Convert a `MacroTypeVariation` to its str representation.
pub fn as_str(&self) -> &str {
match self {
MacroTypeVariation::Signed => "signed",
MacroTypeVariation::Unsigned => "unsigned",
}
}
}
impl Default for MacroTypeVariation {
fn default() -> MacroTypeVariation {
MacroTypeVariation::Unsigned
}
}
impl std::str::FromStr for MacroTypeVariation {
type Err = std::io::Error;
/// Create a `MacroTypeVariation` from a string.
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"signed" => Ok(MacroTypeVariation::Signed),
"unsigned" => Ok(MacroTypeVariation::Unsigned),
_ => Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
concat!(
"Got an invalid MacroTypeVariation. Accepted values ",
"are 'signed' and 'unsigned'"
),
)),
}
}
}
/// Enum for how aliases should be translated.
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum AliasVariation {
@ -3259,10 +3410,7 @@ impl TryToRustTy for Type {
IntKind::I64 => Ok(quote! { i64 }),
IntKind::U64 => Ok(quote! { u64 }),
IntKind::Custom { name, .. } => {
let ident = ctx.rust_ident_raw(name);
Ok(quote! {
#ident
})
Ok(proc_macro2::TokenStream::from_str(name).unwrap())
}
IntKind::U128 => {
Ok(if ctx.options().rust_features.i128_and_u128 {
@ -3370,6 +3518,11 @@ impl TryToRustTy for Type {
inner.into_resolver().through_type_refs().resolve(ctx);
let inner_ty = inner.expect_type();
let is_objc_pointer = match inner_ty.kind() {
TypeKind::ObjCInterface(..) => true,
_ => false,
};
// Regardless if we can properly represent the inner type, we
// should always generate a proper pointer here, so use
// infallible conversion of the inner type.
@ -3378,7 +3531,8 @@ impl TryToRustTy for Type {
// Avoid the first function pointer level, since it's already
// represented in Rust.
if inner_ty.canonical_type(ctx).is_function() {
if inner_ty.canonical_type(ctx).is_function() || is_objc_pointer
{
Ok(ty)
} else {
Ok(ty.to_ptr(is_const))
@ -3394,9 +3548,15 @@ impl TryToRustTy for Type {
TypeKind::ObjCSel => Ok(quote! {
objc::runtime::Sel
}),
TypeKind::ObjCId | TypeKind::ObjCInterface(..) => Ok(quote! {
TypeKind::ObjCId => Ok(quote! {
id
}),
TypeKind::ObjCInterface(ref interface) => {
let name = ctx.rust_ident(interface.name());
Ok(quote! {
#name
})
}
ref u @ TypeKind::UnresolvedTypeRef(..) => {
unreachable!("Should have been resolved after parsing {:?}!", u)
}
@ -3635,7 +3795,30 @@ impl CodeGenerator for Function {
pub fn #ident ( #( #args ),* ) #ret;
}
};
result.push(tokens);
// If we're doing dynamic binding generation, add to the dynamic items.
if ctx.options().dynamic_library_name.is_some() &&
self.kind() == FunctionKind::Function
{
let args_identifiers =
utils::fnsig_argument_identifiers(ctx, signature);
let return_item = ctx.resolve_item(signature.return_type());
let ret_ty = match *return_item.kind().expect_type().kind() {
TypeKind::Void => quote! {()},
_ => return_item.to_rust_ty_or_opaque(ctx, &()),
};
result.dynamic_items().push(
ident,
abi,
signature.is_variadic(),
args,
args_identifiers,
ret,
ret_ty,
);
} else {
result.push(tokens);
}
}
}
@ -3644,7 +3827,7 @@ fn objc_method_codegen(
method: &ObjCMethod,
class_name: Option<&str>,
prefix: &str,
) -> (proc_macro2::TokenStream, proc_macro2::TokenStream) {
) -> proc_macro2::TokenStream {
let signature = method.signature();
let fn_args = utils::fnsig_arguments(ctx, signature);
let fn_ret = utils::fnsig_return_ty(ctx, signature);
@ -3656,7 +3839,7 @@ fn objc_method_codegen(
}
} else {
let fn_args = fn_args.clone();
let args = iter::once(quote! { self }).chain(fn_args.into_iter());
let args = iter::once(quote! { &self }).chain(fn_args.into_iter());
quote! {
( #( #args ),* ) #fn_ret
}
@ -3665,35 +3848,28 @@ fn objc_method_codegen(
let methods_and_args = method.format_method_call(&fn_args);
let body = if method.is_class_method() {
let class_name = class_name
.expect("Generating a class method without class name?")
.to_owned();
let expect_msg = proc_macro2::Literal::string(&format!(
"Couldn't find {}",
let class_name = ctx.rust_ident(
class_name
));
.expect("Generating a class method without class name?")
.to_owned(),
);
quote! {
msg_send!(objc::runtime::Class::get(#class_name).expect(#expect_msg), #methods_and_args)
msg_send!(class!(#class_name), #methods_and_args)
}
} else {
quote! {
msg_send!(self, #methods_and_args)
msg_send!(*self, #methods_and_args)
}
};
let method_name =
ctx.rust_ident(format!("{}{}", prefix, method.rust_name()));
(
quote! {
unsafe fn #method_name #sig {
#body
}
},
quote! {
unsafe fn #method_name #sig ;
},
)
quote! {
unsafe fn #method_name #sig where <Self as std::ops::Deref>::Target: objc::Message + Sized {
#body
}
}
}
impl CodeGenerator for ObjCInterface {
@ -3708,77 +3884,191 @@ impl CodeGenerator for ObjCInterface {
debug_assert!(item.is_enabled_for_codegen(ctx));
let mut impl_items = vec![];
let mut trait_items = vec![];
for method in self.methods() {
let (impl_item, trait_item) =
objc_method_codegen(ctx, method, None, "");
let impl_item = objc_method_codegen(ctx, method, None, "");
impl_items.push(impl_item);
trait_items.push(trait_item)
}
let instance_method_names: Vec<_> =
self.methods().iter().map({ |m| m.rust_name() }).collect();
self.methods().iter().map(|m| m.rust_name()).collect();
for class_method in self.class_methods() {
let ambiquity =
instance_method_names.contains(&class_method.rust_name());
let prefix = if ambiquity { "class_" } else { "" };
let (impl_item, trait_item) = objc_method_codegen(
let impl_item = objc_method_codegen(
ctx,
class_method,
Some(self.name()),
prefix,
);
impl_items.push(impl_item);
trait_items.push(trait_item)
}
let trait_name = ctx.rust_ident(self.rust_name());
let trait_constraints = quote! {
Sized + std::ops::Deref
};
let trait_block = if self.is_template() {
let template_names: Vec<Ident> = self
.template_names
.iter()
.map(|g| ctx.rust_ident(g))
.collect();
quote! {
pub trait #trait_name <#(#template_names),*>{
#( #trait_items )*
pub trait #trait_name <#(#template_names),*> : #trait_constraints {
#( #impl_items )*
}
}
} else {
quote! {
pub trait #trait_name {
#( #trait_items )*
pub trait #trait_name : #trait_constraints {
#( #impl_items )*
}
}
};
let ty_for_impl = quote! {
id
};
let impl_block = if self.is_template() {
let template_names: Vec<Ident> = self
.template_names
.iter()
.map(|g| ctx.rust_ident(g))
.collect();
quote! {
impl <#(#template_names :'static),*> #trait_name <#(#template_names),*> for #ty_for_impl {
#( #impl_items )*
let class_name = ctx.rust_ident(self.name());
if !self.is_category() && !self.is_protocol() {
let struct_block = quote! {
#[repr(transparent)]
#[derive(Clone)]
pub struct #class_name(pub id);
impl std::ops::Deref for #class_name {
type Target = objc::runtime::Object;
fn deref(&self) -> &Self::Target {
unsafe {
&*self.0
}
}
}
unsafe impl objc::Message for #class_name { }
impl #class_name {
pub fn alloc() -> Self {
Self(unsafe {
msg_send!(objc::class!(#class_name), alloc)
})
}
}
};
result.push(struct_block);
let mut protocol_set: HashSet<ItemId> = Default::default();
for protocol_id in self.conforms_to.iter() {
protocol_set.insert(*protocol_id);
let protocol_name = ctx.rust_ident(
ctx.resolve_type(protocol_id.expect_type_id(ctx))
.name()
.unwrap(),
);
let impl_trait = quote! {
impl #protocol_name for #class_name { }
};
result.push(impl_trait);
}
let mut parent_class = self.parent_class;
while let Some(parent_id) = parent_class {
let parent = parent_id
.expect_type_id(ctx)
.into_resolver()
.through_type_refs()
.resolve(ctx)
.expect_type()
.kind();
let parent = match parent {
TypeKind::ObjCInterface(ref parent) => parent,
_ => break,
};
parent_class = parent.parent_class;
let parent_name = ctx.rust_ident(parent.rust_name());
let impl_trait = if parent.is_template() {
let template_names: Vec<Ident> = parent
.template_names
.iter()
.map(|g| ctx.rust_ident(g))
.collect();
quote! {
impl <#(#template_names :'static),*> #parent_name <#(#template_names),*> for #class_name {
}
}
} else {
quote! {
impl #parent_name for #class_name { }
}
};
result.push(impl_trait);
for protocol_id in parent.conforms_to.iter() {
if protocol_set.insert(*protocol_id) {
let protocol_name = ctx.rust_ident(
ctx.resolve_type(protocol_id.expect_type_id(ctx))
.name()
.unwrap(),
);
let impl_trait = quote! {
impl #protocol_name for #class_name { }
};
result.push(impl_trait);
}
}
if !parent.is_template() {
let parent_struct_name = parent.name();
let child_struct_name = self.name();
let parent_struct = ctx.rust_ident(parent_struct_name);
let from_block = quote! {
impl From<#class_name> for #parent_struct {
fn from(child: #class_name) -> #parent_struct {
#parent_struct(child.0)
}
}
};
result.push(from_block);
let error_msg = format!(
"This {} cannot be downcasted to {}",
parent_struct_name, child_struct_name
);
let try_into_block = quote! {
impl std::convert::TryFrom<#parent_struct> for #class_name {
type Error = &'static str;
fn try_from(parent: #parent_struct) -> Result<#class_name, Self::Error> {
let is_kind_of : bool = unsafe { msg_send!(parent, isKindOfClass:class!(#class_name))};
if is_kind_of {
Ok(#class_name(parent.0))
} else {
Err(#error_msg)
}
}
}
};
result.push(try_into_block);
}
}
} else {
quote! {
impl #trait_name for #ty_for_impl {
#( #impl_items )*
}
if !self.is_protocol() {
let impl_block = if self.is_template() {
let template_names: Vec<Ident> = self
.template_names
.iter()
.map(|g| ctx.rust_ident(g))
.collect();
quote! {
impl <#(#template_names :'static),*> #trait_name <#(#template_names),*> for #class_name {
}
}
}
};
} else {
quote! {
impl #trait_name for #class_name {
}
}
};
result.push(impl_block);
}
result.push(trait_block);
result.push(impl_block);
result.saw_objc();
}
}
@ -3808,7 +4098,7 @@ pub(crate) fn codegen(
"Your dot file was generated successfully into: {}",
path
),
Err(e) => error!("{}", e),
Err(e) => warn!("{}", e),
}
}
@ -3818,16 +4108,23 @@ pub(crate) fn codegen(
&(),
);
if let Some(ref lib_name) = context.options().dynamic_library_name {
let lib_ident = context.rust_ident(lib_name);
let dynamic_items_tokens =
result.dynamic_items().get_tokens(lib_ident);
result.push(dynamic_items_tokens);
}
result.items
})
}
mod utils {
pub mod utils {
use super::{error, ToRustTyOrOpaque};
use ir::context::BindgenContext;
use ir::function::{Abi, FunctionSig};
use ir::item::{Item, ItemCanonicalPath};
use ir::ty::TypeKind;
use crate::ir::context::BindgenContext;
use crate::ir::function::{Abi, FunctionSig};
use crate::ir::item::{Item, ItemCanonicalPath};
use crate::ir::ty::TypeKind;
use proc_macro2;
use std::borrow::Cow;
use std::mem;
@ -4189,11 +4486,12 @@ mod utils {
TypeKind::Pointer(inner) => {
let inner = ctx.resolve_item(inner);
let inner_ty = inner.expect_type();
if let TypeKind::ObjCInterface(_) =
if let TypeKind::ObjCInterface(ref interface) =
*inner_ty.canonical_type(ctx).kind()
{
let name = ctx.rust_ident(interface.name());
quote! {
id
#name
}
} else {
arg_item.to_rust_ty_or_opaque(ctx, &())
@ -4226,6 +4524,35 @@ mod utils {
args
}
pub fn fnsig_argument_identifiers(
ctx: &BindgenContext,
sig: &FunctionSig,
) -> Vec<proc_macro2::TokenStream> {
let mut unnamed_arguments = 0;
let args = sig
.argument_types()
.iter()
.map(|&(ref name, _ty)| {
let arg_name = match *name {
Some(ref name) => ctx.rust_mangle(name).into_owned(),
None => {
unnamed_arguments += 1;
format!("arg{}", unnamed_arguments)
}
};
assert!(!arg_name.is_empty());
let arg_name = ctx.rust_ident(arg_name);
quote! {
#arg_name
}
})
.collect::<Vec<_>>();
args
}
pub fn fnsig_block(
ctx: &BindgenContext,
sig: &FunctionSig,

Просмотреть файл

@ -2,10 +2,10 @@
use super::helpers;
use ir::comp::CompInfo;
use ir::context::BindgenContext;
use ir::layout::Layout;
use ir::ty::{Type, TypeKind};
use crate::ir::comp::CompInfo;
use crate::ir::context::BindgenContext;
use crate::ir::layout::Layout;
use crate::ir::ty::{Type, TypeKind};
use proc_macro2::{self, Ident, Span};
use std::cmp;
@ -248,7 +248,7 @@ impl<'a> StructLayoutTracker<'a> {
);
if layout.size < self.latest_offset {
error!(
warn!(
"Calculated wrong layout for {}, too more {} bytes",
self.name,
self.latest_offset - layout.size

Просмотреть файл

@ -3,17 +3,17 @@
use std::fmt;
use super::{generate_dependencies, ConstrainResult, MonotoneFramework};
use ir::analysis::has_vtable::HasVtable;
use ir::comp::CompKind;
use ir::context::{BindgenContext, ItemId};
use ir::derive::CanDerive;
use ir::function::FunctionSig;
use ir::item::{IsOpaque, Item};
use ir::template::TemplateParameters;
use ir::traversal::{EdgeKind, Trace};
use ir::ty::RUST_DERIVE_IN_ARRAY_LIMIT;
use ir::ty::{Type, TypeKind};
use {Entry, HashMap, HashSet};
use crate::ir::analysis::has_vtable::HasVtable;
use crate::ir::comp::CompKind;
use crate::ir::context::{BindgenContext, ItemId};
use crate::ir::derive::CanDerive;
use crate::ir::function::FunctionSig;
use crate::ir::item::{IsOpaque, Item};
use crate::ir::template::TemplateParameters;
use crate::ir::traversal::{EdgeKind, Trace};
use crate::ir::ty::RUST_DERIVE_IN_ARRAY_LIMIT;
use crate::ir::ty::{Type, TypeKind};
use crate::{Entry, HashMap, HashSet};
/// Which trait to consider when doing the `CannotDerive` analysis.
#[derive(Debug, Copy, Clone)]
@ -445,11 +445,12 @@ impl DeriveTrait {
fn not_by_name(&self, ctx: &BindgenContext, item: &Item) -> bool {
match self {
DeriveTrait::Copy => ctx.no_copy_by_name(item),
DeriveTrait::Debug => ctx.no_debug_by_name(item),
DeriveTrait::Default => ctx.no_default_by_name(item),
DeriveTrait::Hash => ctx.no_hash_by_name(item),
DeriveTrait::PartialEqOrPartialOrd => {
ctx.no_partialeq_by_name(item)
}
_ => false,
}
}

Просмотреть файл

@ -1,11 +1,11 @@
//! Determining which types have destructors
use super::{generate_dependencies, ConstrainResult, MonotoneFramework};
use ir::comp::{CompKind, Field, FieldMethods};
use ir::context::{BindgenContext, ItemId};
use ir::traversal::EdgeKind;
use ir::ty::TypeKind;
use {HashMap, HashSet};
use crate::ir::comp::{CompKind, Field, FieldMethods};
use crate::ir::context::{BindgenContext, ItemId};
use crate::ir::traversal::EdgeKind;
use crate::ir::ty::TypeKind;
use crate::{HashMap, HashSet};
/// An analysis that finds for each IR item whether it has a destructor or not
///

Просмотреть файл

@ -1,12 +1,12 @@
//! Determining which types has float.
use super::{generate_dependencies, ConstrainResult, MonotoneFramework};
use ir::comp::Field;
use ir::comp::FieldMethods;
use ir::context::{BindgenContext, ItemId};
use ir::traversal::EdgeKind;
use ir::ty::TypeKind;
use {HashMap, HashSet};
use crate::ir::comp::Field;
use crate::ir::comp::FieldMethods;
use crate::ir::context::{BindgenContext, ItemId};
use crate::ir::traversal::EdgeKind;
use crate::ir::ty::TypeKind;
use crate::{HashMap, HashSet};
/// An analysis that finds for each IR item whether it has float or not.
///

Просмотреть файл

@ -1,12 +1,12 @@
//! Determining which types has typed parameters in array.
use super::{generate_dependencies, ConstrainResult, MonotoneFramework};
use ir::comp::Field;
use ir::comp::FieldMethods;
use ir::context::{BindgenContext, ItemId};
use ir::traversal::EdgeKind;
use ir::ty::TypeKind;
use {HashMap, HashSet};
use crate::ir::comp::Field;
use crate::ir::comp::FieldMethods;
use crate::ir::context::{BindgenContext, ItemId};
use crate::ir::traversal::EdgeKind;
use crate::ir::ty::TypeKind;
use crate::{HashMap, HashSet};
/// An analysis that finds for each IR item whether it has array or not.
///

Просмотреть файл

@ -1,12 +1,12 @@
//! Determining which types has vtable
use super::{generate_dependencies, ConstrainResult, MonotoneFramework};
use ir::context::{BindgenContext, ItemId};
use ir::traversal::EdgeKind;
use ir::ty::TypeKind;
use crate::ir::context::{BindgenContext, ItemId};
use crate::ir::traversal::EdgeKind;
use crate::ir::ty::TypeKind;
use crate::{Entry, HashMap};
use std::cmp;
use std::ops;
use {Entry, HashMap};
/// The result of the `HasVtableAnalysis` for an individual item.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]

Просмотреть файл

@ -53,12 +53,12 @@ pub use self::has_float::HasFloat;
mod sizedness;
pub use self::sizedness::{Sizedness, SizednessAnalysis, SizednessResult};
use ir::context::{BindgenContext, ItemId};
use crate::ir::context::{BindgenContext, ItemId};
use ir::traversal::{EdgeKind, Trace};
use crate::ir::traversal::{EdgeKind, Trace};
use crate::HashMap;
use std::fmt;
use std::ops;
use HashMap;
/// An analysis in the monotone framework.
///
@ -211,7 +211,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use {HashMap, HashSet};
use crate::{HashMap, HashSet};
// Here we find the set of nodes that are reachable from any given
// node. This is a lattice mapping nodes to subsets of all nodes. Our join

Просмотреть файл

@ -3,12 +3,12 @@
use super::{
generate_dependencies, ConstrainResult, HasVtable, MonotoneFramework,
};
use ir::context::{BindgenContext, TypeId};
use ir::item::IsOpaque;
use ir::traversal::EdgeKind;
use ir::ty::TypeKind;
use crate::ir::context::{BindgenContext, TypeId};
use crate::ir::item::IsOpaque;
use crate::ir::traversal::EdgeKind;
use crate::ir::ty::TypeKind;
use crate::{Entry, HashMap};
use std::{cmp, ops};
use {Entry, HashMap};
/// The result of the `Sizedness` analysis for an individual item.
///

Просмотреть файл

@ -89,12 +89,12 @@
//! See `src/ir/analysis.rs` for more.
use super::{ConstrainResult, MonotoneFramework};
use ir::context::{BindgenContext, ItemId};
use ir::item::{Item, ItemSet};
use ir::template::{TemplateInstantiation, TemplateParameters};
use ir::traversal::{EdgeKind, Trace};
use ir::ty::TypeKind;
use {HashMap, HashSet};
use crate::ir::context::{BindgenContext, ItemId};
use crate::ir::item::{Item, ItemSet};
use crate::ir::template::{TemplateInstantiation, TemplateParameters};
use crate::ir::traversal::{EdgeKind, Trace};
use crate::ir::ty::TypeKind;
use crate::{HashMap, HashSet};
/// An analysis that finds for each IR item its set of template parameters that
/// it uses.

Просмотреть файл

@ -4,7 +4,7 @@
//! replace other types with, mark as opaque, etc. This module deals with all of
//! that stuff.
use clang;
use crate::clang;
/// What kind of accessor should we provide for a field?
#[derive(Copy, PartialEq, Clone, Debug)]
@ -38,6 +38,10 @@ pub struct Annotations {
/// Manually disable deriving copy/clone on this type. Only applies to
/// struct or union types.
disallow_copy: bool,
/// Manually disable deriving debug on this type.
disallow_debug: bool,
/// Manually disable deriving/implement default on this type.
disallow_default: bool,
/// Whether fields should be marked as private or not. You can set this on
/// structs (it will apply to all the fields), or individual fields.
private_fields: Option<bool>,
@ -78,6 +82,8 @@ impl Default for Annotations {
hide: false,
use_instead_of: None,
disallow_copy: false,
disallow_debug: false,
disallow_default: false,
private_fields: None,
accessor_kind: None,
constify_enum_variant: false,
@ -147,6 +153,16 @@ impl Annotations {
self.disallow_copy
}
/// Should we avoid implementing the `Debug` trait?
pub fn disallow_debug(&self) -> bool {
self.disallow_debug
}
/// Should we avoid implementing the `Default` trait?
pub fn disallow_default(&self) -> bool {
self.disallow_default
}
/// Should the fields be private?
pub fn private_fields(&self) -> Option<bool> {
self.private_fields
@ -172,6 +188,8 @@ impl Annotations {
"opaque" => self.opaque = true,
"hide" => self.hide = true,
"nocopy" => self.disallow_copy = true,
"nodebug" => self.disallow_debug = true,
"nodefault" => self.disallow_default = true,
"replaces" => {
self.use_instead_of = Some(
attr.value.split("::").map(Into::into).collect(),

35
third_party/rust/bindgen/src/ir/comp.rs поставляемый
Просмотреть файл

@ -9,15 +9,15 @@ use super::layout::Layout;
use super::template::TemplateParameters;
use super::traversal::{EdgeKind, Trace, Tracer};
use super::ty::RUST_DERIVE_IN_ARRAY_LIMIT;
use clang;
use codegen::struct_layout::{align_to, bytes_from_bits_pow2};
use ir::derive::CanDeriveCopy;
use parse::{ClangItemParser, ParseError};
use crate::clang;
use crate::codegen::struct_layout::{align_to, bytes_from_bits_pow2};
use crate::ir::derive::CanDeriveCopy;
use crate::parse::{ClangItemParser, ParseError};
use crate::HashMap;
use peeking_take_while::PeekableExt;
use std::cmp;
use std::io;
use std::mem;
use HashMap;
/// The kind of compound type.
#[derive(Debug, Copy, Clone, PartialEq)]
@ -748,16 +748,13 @@ impl CompFields {
match result {
Ok((fields, has_bitfield_units)) => {
mem::replace(
self,
CompFields::AfterComputingBitfieldUnits {
fields,
has_bitfield_units,
},
);
*self = CompFields::AfterComputingBitfieldUnits {
fields,
has_bitfield_units,
};
}
Err(()) => {
mem::replace(self, CompFields::ErrorComputingBitfieldUnits);
*self = CompFields::ErrorComputingBitfieldUnits;
}
}
}
@ -828,9 +825,11 @@ impl CompFields {
}
anon_field_counter += 1;
let generated_name =
format!("__bindgen_anon_{}", anon_field_counter);
*name = Some(generated_name);
*name = Some(format!(
"{}{}",
ctx.options().anon_fields_prefix,
anon_field_counter
));
}
Field::Bitfields(ref mut bu) => {
for bitfield in &mut bu.bitfields {
@ -1410,8 +1409,8 @@ impl CompInfo {
Item::from_ty_or_ref(cur.cur_type(), cur, None, ctx);
ci.base_members.push(Base {
ty: type_id,
kind: kind,
field_name: field_name,
kind,
field_name,
});
}
CXCursor_Constructor | CXCursor_Destructor |

100
third_party/rust/bindgen/src/ir/context.rs поставляемый
Просмотреть файл

@ -19,19 +19,19 @@ use super::module::{Module, ModuleKind};
use super::template::{TemplateInstantiation, TemplateParameters};
use super::traversal::{self, Edge, ItemTraversal};
use super::ty::{FloatKind, Type, TypeKind};
use callbacks::ParseCallbacks;
use crate::callbacks::ParseCallbacks;
use crate::clang::{self, Cursor};
use crate::parse::ClangItemParser;
use crate::BindgenOptions;
use crate::{Entry, HashMap, HashSet};
use cexpr;
use clang::{self, Cursor};
use clang_sys;
use parse::ClangItemParser;
use proc_macro2::{Ident, Span};
use std::borrow::Cow;
use std::cell::Cell;
use std::collections::HashMap as StdHashMap;
use std::iter::IntoIterator;
use std::mem;
use BindgenOptions;
use {Entry, HashMap, HashSet};
/// An identifier for some kind of IR item.
#[derive(Debug, Copy, Clone, Eq, PartialOrd, Ord, Hash)]
@ -507,46 +507,12 @@ impl<'ctx> WhitelistedItemsTraversal<'ctx> {
}
}
const HOST_TARGET: &'static str =
include_str!(concat!(env!("OUT_DIR"), "/host-target.txt"));
/// Returns the effective target, and whether it was explicitly specified on the
/// clang flags.
fn find_effective_target(clang_args: &[String]) -> (String, bool) {
use std::env;
let mut args = clang_args.iter();
while let Some(opt) = args.next() {
if opt.starts_with("--target=") {
let mut split = opt.split('=');
split.next();
return (split.next().unwrap().to_owned(), true);
}
if opt == "-target" {
if let Some(target) = args.next() {
return (target.clone(), true);
}
}
}
// If we're running from a build script, try to find the cargo target.
if let Ok(t) = env::var("TARGET") {
return (t, false);
}
(HOST_TARGET.to_owned(), false)
}
impl BindgenContext {
/// Construct the context for the given `options`.
pub(crate) fn new(options: BindgenOptions) -> Self {
// TODO(emilio): Use the CXTargetInfo here when available.
//
// see: https://reviews.llvm.org/D32389
let (effective_target, explicit_target) =
find_effective_target(&options.clang_args);
let index = clang::Index::new(false, true);
let parse_options =
@ -555,19 +521,11 @@ impl BindgenContext {
let translation_unit = {
let _t =
Timer::new("translation_unit").with_output(options.time_phases);
let clang_args = if explicit_target {
Cow::Borrowed(&options.clang_args)
} else {
let mut args = Vec::with_capacity(options.clang_args.len() + 1);
args.push(format!("--target={}", effective_target));
args.extend_from_slice(&options.clang_args);
Cow::Owned(args)
};
clang::TranslationUnit::parse(
&index,
"",
&clang_args,
&options.clang_args,
&options.input_unsaved_files,
parse_options,
).expect("libclang error; possible causes include:
@ -580,22 +538,6 @@ If you encounter an error missing from this list, please file an issue or a PR!"
};
let target_info = clang::TargetInfo::new(&translation_unit);
#[cfg(debug_assertions)]
{
if let Some(ref ti) = target_info {
if effective_target == HOST_TARGET {
assert_eq!(
ti.pointer_width / 8,
mem::size_of::<*mut ()>(),
"{:?} {:?}",
effective_target,
HOST_TARGET
);
}
}
}
let root_module = Self::build_root_module(ItemId(0));
let root_module_id = root_module.id().as_module_id_unchecked();
@ -635,6 +577,14 @@ If you encounter an error missing from this list, please file an issue or a PR!"
}
}
/// Returns `true` if the target architecture is wasm32
pub fn is_target_wasm32(&self) -> bool {
match self.target_info {
Some(ref ti) => ti.triple.starts_with("wasm32-"),
None => false,
}
}
/// Creates a timer for the current bindgen phase. If time_phases is `true`,
/// the timer will print to stderr when it is dropped, otherwise it will do
/// nothing.
@ -864,7 +814,9 @@ If you encounter an error missing from this list, please file an issue or a PR!"
"return" | "Self" | "self" | "sizeof" | "static" |
"struct" | "super" | "trait" | "true" | "type" | "typeof" |
"unsafe" | "unsized" | "use" | "virtual" | "where" |
"while" | "yield" | "bool" | "_" => true,
"while" | "yield" | "str" | "bool" | "f32" | "f64" |
"usize" | "isize" | "u128" | "i128" | "u64" | "i64" |
"u32" | "i32" | "u16" | "i16" | "u8" | "i8" | "_" => true,
_ => false,
}
{
@ -2398,15 +2350,15 @@ If you encounter an error missing from this list, please file an issue or a PR!"
self.codegen_items = Some(codegen_items);
for item in self.options().whitelisted_functions.unmatched_items() {
error!("unused option: --whitelist-function {}", item);
warn!("unused option: --whitelist-function {}", item);
}
for item in self.options().whitelisted_vars.unmatched_items() {
error!("unused option: --whitelist-var {}", item);
warn!("unused option: --whitelist-var {}", item);
}
for item in self.options().whitelisted_types.unmatched_items() {
error!("unused option: --whitelist-type {}", item);
warn!("unused option: --whitelist-type {}", item);
}
}
@ -2633,6 +2585,18 @@ If you encounter an error missing from this list, please file an issue or a PR!"
self.options().no_copy_types.matches(&name)
}
/// Check if `--no-debug` flag is enabled for this item.
pub fn no_debug_by_name(&self, item: &Item) -> bool {
let name = item.path_for_whitelisting(self)[1..].join("::");
self.options().no_debug_types.matches(&name)
}
/// Check if `--no-default` flag is enabled for this item.
pub fn no_default_by_name(&self, item: &Item) -> bool {
let name = item.path_for_whitelisting(self)[1..].join("::");
self.options().no_default_types.matches(&name)
}
/// Check if `--no-hash` flag is enabled for this item.
pub fn no_hash_by_name(&self, item: &Item) -> bool {
let name = item.path_for_whitelisting(self)[1..].join("::");

38
third_party/rust/bindgen/src/ir/enum_ty.rs поставляемый
Просмотреть файл

@ -3,12 +3,11 @@
use super::super::codegen::EnumVariation;
use super::context::{BindgenContext, TypeId};
use super::item::Item;
use super::ty::TypeKind;
use clang;
use ir::annotations::Annotations;
use ir::item::ItemCanonicalPath;
use parse::{ClangItemParser, ParseError};
use regex_set::RegexSet;
use super::ty::{Type, TypeKind};
use crate::clang;
use crate::ir::annotations::Annotations;
use crate::parse::{ClangItemParser, ParseError};
use crate::regex_set::RegexSet;
/// An enum representing custom handling that can be given to a variant.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
@ -69,15 +68,17 @@ impl Enum {
.and_then(|et| Item::from_ty(&et, declaration, None, ctx).ok());
let mut variants = vec![];
let variant_ty =
repr.and_then(|r| ctx.resolve_type(r).safe_canonical_type(ctx));
let is_bool = variant_ty.map_or(false, Type::is_bool);
// Assume signedness since the default type by the C standard is an int.
let is_signed = repr
.and_then(|r| ctx.resolve_type(r).safe_canonical_type(ctx))
.map_or(true, |ty| match *ty.kind() {
TypeKind::Int(ref int_kind) => int_kind.is_signed(),
ref other => {
panic!("Since when enums can be non-integers? {:?}", other)
}
});
let is_signed = variant_ty.map_or(true, |ty| match *ty.kind() {
TypeKind::Int(ref int_kind) => int_kind.is_signed(),
ref other => {
panic!("Since when enums can be non-integers? {:?}", other)
}
});
let type_name = ty.spelling();
let type_name = if type_name.is_empty() {
@ -90,7 +91,9 @@ impl Enum {
let definition = declaration.definition().unwrap_or(declaration);
definition.visit(|cursor| {
if cursor.kind() == CXCursor_EnumConstantDecl {
let value = if is_signed {
let value = if is_bool {
cursor.enum_val_boolean().map(EnumVariantValue::Boolean)
} else if is_signed {
cursor.enum_val_signed().map(EnumVariantValue::Signed)
} else {
cursor.enum_val_unsigned().map(EnumVariantValue::Unsigned)
@ -149,7 +152,7 @@ impl Enum {
enums: &RegexSet,
item: &Item,
) -> bool {
let path = item.canonical_path(ctx);
let path = item.path_for_whitelisting(ctx);
let enum_ty = item.expect_type();
if enums.matches(&path[1..].join("::")) {
@ -234,6 +237,9 @@ pub struct EnumVariant {
/// A constant value assigned to an enumeration variant.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum EnumVariantValue {
/// A boolean constant.
Boolean(bool),
/// A signed constant.
Signed(i64),

38
third_party/rust/bindgen/src/ir/function.rs поставляемый
Просмотреть файл

@ -6,9 +6,11 @@ use super::dot::DotAttributes;
use super::item::Item;
use super::traversal::{EdgeKind, Trace, Tracer};
use super::ty::TypeKind;
use clang;
use crate::clang;
use crate::parse::{
ClangItemParser, ClangSubItemParser, ParseError, ParseResult,
};
use clang_sys::{self, CXCallingConv};
use parse::{ClangItemParser, ClangSubItemParser, ParseError, ParseResult};
use proc_macro2;
use quote;
use quote::TokenStreamExt;
@ -309,7 +311,7 @@ fn args_from_ty_and_cursor(
cursor: &clang::Cursor,
ctx: &mut BindgenContext,
) -> Vec<(Option<String>, TypeId)> {
let cursor_args = cursor.args().unwrap().into_iter();
let cursor_args = cursor.args().unwrap_or_default().into_iter();
let type_args = ty.args().unwrap_or_default().into_iter();
// Argument types can be found in either the cursor or the type, but argument names may only be
@ -375,9 +377,14 @@ impl FunctionSig {
return Err(ParseError::Continue);
}
// Don't parse operatorxx functions in C++
let spelling = cursor.spelling();
if spelling.starts_with("operator") {
// Don't parse operatorxx functions in C++
let is_operator = |spelling: &str| {
spelling.starts_with("operator") &&
!clang::is_valid_identifier(spelling)
};
if is_operator(&spelling) {
return Err(ParseError::Continue);
}
@ -419,7 +426,16 @@ impl FunctionSig {
}
CXChildVisit_Continue
});
args
if args.is_empty() {
// FIXME(emilio): Sometimes libclang doesn't expose the
// right AST for functions tagged as stdcall and such...
//
// https://bugs.llvm.org/show_bug.cgi?id=45919
args_from_ty_and_cursor(&ty, &cursor, ctx)
} else {
args
}
}
};
@ -479,7 +495,15 @@ impl FunctionSig {
} else {
ty.ret_type().ok_or(ParseError::Continue)?
};
let ret = Item::from_ty_or_ref(ty_ret_type, cursor, None, ctx);
let ret = if is_constructor && ctx.is_target_wasm32() {
// Constructors in Clang wasm32 target return a pointer to the object
// being constructed.
let void = Item::builtin_type(TypeKind::Void, false, ctx);
Item::builtin_type(TypeKind::Pointer(void), false, ctx)
} else {
Item::from_ty_or_ref(ty_ret_type, cursor, None, ctx)
};
// Clang plays with us at "find the calling convention", see #549 and
// co. This seems to be a better fix than that commit.

45
third_party/rust/bindgen/src/ir/item.rs поставляемый
Просмотреть файл

@ -18,10 +18,12 @@ use super::module::Module;
use super::template::{AsTemplateParam, TemplateParameters};
use super::traversal::{EdgeKind, Trace, Tracer};
use super::ty::{Type, TypeKind};
use clang;
use crate::clang;
use crate::parse::{
ClangItemParser, ClangSubItemParser, ParseError, ParseResult,
};
use clang_sys;
use lazycell::LazyCell;
use parse::{ClangItemParser, ClangSubItemParser, ParseError, ParseResult};
use regex;
use std::cell::Cell;
use std::collections::BTreeSet;
@ -99,24 +101,23 @@ pub trait ItemAncestors {
fn ancestors<'a>(&self, ctx: &'a BindgenContext) -> ItemAncestorsIter<'a>;
}
cfg_if! {
if #[cfg(testing_only_extra_assertions)] {
type DebugOnlyItemSet = ItemSet;
} else {
struct DebugOnlyItemSet;
#[cfg(testing_only_extra_assertions)]
type DebugOnlyItemSet = ItemSet;
impl DebugOnlyItemSet {
fn new() -> Self {
DebugOnlyItemSet
}
#[cfg(not(testing_only_extra_assertions))]
struct DebugOnlyItemSet;
fn contains(&self, _id: &ItemId) -> bool {
false
}
fn insert(&mut self, _id: ItemId) {}
}
#[cfg(not(testing_only_extra_assertions))]
impl DebugOnlyItemSet {
fn new() -> Self {
DebugOnlyItemSet
}
fn contains(&self, _id: &ItemId) -> bool {
false
}
fn insert(&mut self, _id: ItemId) {}
}
/// An iterator over an item and its ancestors.
@ -130,7 +131,7 @@ impl<'a> ItemAncestorsIter<'a> {
fn new<Id: Into<ItemId>>(ctx: &'a BindgenContext, id: Id) -> Self {
ItemAncestorsIter {
item: id.into(),
ctx: ctx,
ctx,
seen: DebugOnlyItemSet::new(),
}
}
@ -1295,8 +1296,8 @@ impl ClangItemParser for Item {
parent_id: Option<ItemId>,
ctx: &mut BindgenContext,
) -> Result<ItemId, ParseError> {
use crate::ir::var::Var;
use clang_sys::*;
use ir::var::Var;
if !cursor.is_valid() {
return Err(ParseError::Continue);
@ -1330,9 +1331,7 @@ impl ClangItemParser for Item {
Ok(ParseResult::AlreadyResolved(id)) => {
return Ok(id);
}
Err(ParseError::Recurse) => {
return Err(ParseError::Recurse)
}
Err(ParseError::Recurse) => return Err(ParseError::Recurse),
Err(ParseError::Continue) => {}
}
};
@ -1426,7 +1425,7 @@ impl ClangItemParser for Item {
// ignore toplevel operator overloads
let spelling = cursor.spelling();
if !spelling.starts_with("operator") {
error!(
warn!(
"Unhandled cursor kind {:?}: {:?}",
cursor.kind(),
cursor

4
third_party/rust/bindgen/src/ir/layout.rs поставляемый
Просмотреть файл

@ -2,8 +2,8 @@
use super::derive::CanDerive;
use super::ty::{Type, TypeKind, RUST_DERIVE_IN_ARRAY_LIMIT};
use clang;
use ir::context::BindgenContext;
use crate::clang;
use crate::ir::context::BindgenContext;
use std::cmp;
/// A type that represents the struct layout of a type.

6
third_party/rust/bindgen/src/ir/module.rs поставляемый
Просмотреть файл

@ -3,9 +3,9 @@
use super::context::BindgenContext;
use super::dot::DotAttributes;
use super::item::ItemSet;
use clang;
use parse::{ClangSubItemParser, ParseError, ParseResult};
use parse_one;
use crate::clang;
use crate::parse::{ClangSubItemParser, ParseError, ParseResult};
use crate::parse_one;
use std::io;
/// Whether this module is inline or not.

36
third_party/rust/bindgen/src/ir/objc.rs поставляемый
Просмотреть файл

@ -2,9 +2,11 @@
use super::context::{BindgenContext, ItemId};
use super::function::FunctionSig;
use super::item::Item;
use super::traversal::{Trace, Tracer};
use super::ty::TypeKind;
use clang;
use crate::clang;
use crate::parse::ClangItemParser;
use clang_sys::CXChildVisit_Continue;
use clang_sys::CXCursor_ObjCCategoryDecl;
use clang_sys::CXCursor_ObjCClassMethodDecl;
@ -12,6 +14,7 @@ use clang_sys::CXCursor_ObjCClassRef;
use clang_sys::CXCursor_ObjCInstanceMethodDecl;
use clang_sys::CXCursor_ObjCProtocolDecl;
use clang_sys::CXCursor_ObjCProtocolRef;
use clang_sys::CXCursor_ObjCSuperClassRef;
use clang_sys::CXCursor_TemplateTypeParameter;
use proc_macro2::{Ident, Span, TokenStream};
@ -31,7 +34,11 @@ pub struct ObjCInterface {
/// The list of template names almost always, ObjectType or KeyType
pub template_names: Vec<String>,
conforms_to: Vec<ItemId>,
/// The list of protocols that this interface conforms to.
pub conforms_to: Vec<ItemId>,
/// The direct parent for this interface.
pub parent_class: Option<ItemId>,
/// List of the methods defined in this interfae
methods: Vec<ObjCMethod>,
@ -63,6 +70,7 @@ impl ObjCInterface {
category: None,
is_protocol: false,
template_names: Vec::new(),
parent_class: None,
conforms_to: Vec::new(),
methods: Vec::new(),
class_methods: Vec::new(),
@ -77,15 +85,15 @@ impl ObjCInterface {
/// Formats the name for rust
/// Can be like NSObject, but with categories might be like NSObject_NSCoderMethods
/// and protocols are like protocol_NSObject
/// and protocols are like PNSObject
pub fn rust_name(&self) -> String {
if let Some(ref cat) = self.category {
format!("{}_{}", self.name(), cat)
} else {
if self.is_protocol {
format!("protocol_{}", self.name())
format!("P{}", self.name())
} else {
self.name().to_owned()
format!("I{}", self.name().to_owned())
}
}
}
@ -100,6 +108,16 @@ impl ObjCInterface {
&self.methods
}
/// Is this a protocol?
pub fn is_protocol(&self) -> bool {
self.is_protocol
}
/// Is this a category?
pub fn is_category(&self) -> bool {
self.category.is_some()
}
/// List of the class methods defined in this interface
pub fn class_methods(&self) -> &Vec<ObjCMethod> {
&self.class_methods
@ -129,13 +147,13 @@ impl ObjCInterface {
}
CXCursor_ObjCProtocolRef => {
// Gather protocols this interface conforms to
let needle = format!("protocol_{}", c.spelling());
let needle = format!("P{}", c.spelling());
let items_map = ctx.items();
debug!("Interface {} conforms to {}, find the item", interface.name, needle);
for (id, item) in items_map
{
if let Some(ty) = item.as_type() {
if let Some(ty) = item.as_type() {
match *ty.kind() {
TypeKind::ObjCInterface(ref protocol) => {
if protocol.is_protocol
@ -168,6 +186,10 @@ impl ObjCInterface {
let name = c.spelling();
interface.template_names.push(name);
}
CXCursor_ObjCSuperClassRef => {
let item = Item::from_ty_or_ref(c.cur_type(), c, None, ctx);
interface.parent_class = Some(item.into());
},
_ => {}
}
CXChildVisit_Continue

11
third_party/rust/bindgen/src/ir/template.rs поставляемый
Просмотреть файл

@ -28,10 +28,10 @@
//! ```
use super::context::{BindgenContext, ItemId, TypeId};
use super::item::{IsOpaque, Item, ItemAncestors, ItemCanonicalPath};
use super::item::{IsOpaque, Item, ItemAncestors};
use super::traversal::{EdgeKind, Trace, Tracer};
use clang;
use parse::ClangItemParser;
use crate::clang;
use crate::parse::ClangItemParser;
/// Template declaration (and such declaration's template parameters) related
/// methods.
@ -306,12 +306,13 @@ impl IsOpaque for TemplateInstantiation {
// correct fix is to make `canonical_{name,path}` include template
// arguments properly.
let mut path = item.canonical_path(ctx);
let mut path = item.path_for_whitelisting(ctx).clone();
let args: Vec<_> = self
.template_arguments()
.iter()
.map(|arg| {
let arg_path = arg.canonical_path(ctx);
let arg_path =
ctx.resolve_item(*arg).path_for_whitelisting(ctx);
arg_path[1..].join("::")
})
.collect();

13
third_party/rust/bindgen/src/ir/ty.rs поставляемый
Просмотреть файл

@ -13,8 +13,8 @@ use super::template::{
AsTemplateParam, TemplateInstantiation, TemplateParameters,
};
use super::traversal::{EdgeKind, Trace, Tracer};
use clang::{self, Cursor};
use parse::{ClangItemParser, ParseError, ParseResult};
use crate::clang::{self, Cursor};
use crate::parse::{ClangItemParser, ParseError, ParseResult};
use std::borrow::Cow;
use std::io;
@ -973,7 +973,7 @@ impl Type {
let inner_type = match inner {
Ok(inner) => inner,
Err(..) => {
error!(
warn!(
"Failed to parse template alias \
{:?}",
location
@ -1196,7 +1196,7 @@ impl Type {
return Err(ParseError::Continue);
}
_ => {
error!(
warn!(
"unsupported type: kind = {:?}; ty = {:?}; at {:?}",
ty.kind(),
ty,
@ -1209,7 +1209,10 @@ impl Type {
let name = if name.is_empty() { None } else { Some(name) };
let is_const = ty.is_const();
let is_const = ty.is_const() ||
(ty.kind() == CXType_ConstantArray &&
ty.elem_type()
.map_or(false, |element| element.is_const()));
let ty = Type::new(name, layout, kind, is_const);
// TODO: maybe declaration.canonical()?

82
third_party/rust/bindgen/src/ir/var.rs поставляемый
Просмотреть файл

@ -1,15 +1,19 @@
//! Intermediate representation of variables.
use super::super::codegen::MacroTypeVariation;
use super::context::{BindgenContext, TypeId};
use super::dot::DotAttributes;
use super::function::cursor_mangling;
use super::int::IntKind;
use super::item::Item;
use super::ty::{FloatKind, TypeKind};
use callbacks::MacroParsingBehavior;
use crate::callbacks::MacroParsingBehavior;
use crate::clang;
use crate::clang::ClangToken;
use crate::parse::{
ClangItemParser, ClangSubItemParser, ParseError, ParseResult,
};
use cexpr;
use clang;
use parse::{ClangItemParser, ClangSubItemParser, ParseError, ParseResult};
use std::io;
use std::num::Wrapping;
@ -114,9 +118,12 @@ impl DotAttributes for Var {
}
// TODO(emilio): we could make this more (or less) granular, I guess.
fn default_macro_constant_type(value: i64) -> IntKind {
if value < 0 {
if value < i32::min_value() as i64 {
fn default_macro_constant_type(ctx: &BindgenContext, value: i64) -> IntKind {
if value < 0 ||
ctx.options().default_macro_constant_type ==
MacroTypeVariation::Signed
{
if value < i32::min_value() as i64 || value > i32::max_value() as i64 {
IntKind::I64
} else {
IntKind::I32
@ -128,6 +135,54 @@ fn default_macro_constant_type(value: i64) -> IntKind {
}
}
/// Determines whether a set of tokens from a CXCursor_MacroDefinition
/// represent a function-like macro. If so, calls the func_macro callback
/// and returns `Err(ParseError::Continue)` to signal to skip further
/// processing. If conversion to UTF-8 fails (it is performed only where it
/// should be infallible), then `Err(ParseError::Continue)` is returned as well.
fn handle_function_macro(
cursor: &clang::Cursor,
tokens: &[ClangToken],
callbacks: &dyn crate::callbacks::ParseCallbacks,
) -> Result<(), ParseError> {
// TODO: Hoist the `is_macro_function_like` check into this function's
// caller, and thus avoid allocating the `tokens` vector for non-functional
// macros.
let is_functional_macro = cursor.is_macro_function_like();
if !is_functional_macro {
return Ok(());
}
let is_closing_paren = |t: &ClangToken| {
// Test cheap token kind before comparing exact spellings.
t.kind == clang_sys::CXToken_Punctuation && t.spelling() == b")"
};
let boundary = tokens.iter().position(is_closing_paren);
let mut spelled = tokens.iter().map(ClangToken::spelling);
// Add 1, to convert index to length.
let left = spelled
.by_ref()
.take(boundary.ok_or(ParseError::Continue)? + 1);
let left = left.collect::<Vec<_>>().concat();
let left = String::from_utf8(left).map_err(|_| ParseError::Continue)?;
let right = spelled;
// Drop last token with LLVM < 4.0, due to an LLVM bug.
//
// See:
// https://bugs.llvm.org//show_bug.cgi?id=9069
let len = match (right.len(), crate::clang_version().parsed) {
(len, Some((v, _))) if len > 0 && v < 4 => len - 1,
(len, _) => len,
};
let right: Vec<_> = right.take(len).collect();
callbacks.func_macro(&left, &right);
// We handled the macro, skip future macro processing.
Err(ParseError::Continue)
}
impl ClangSubItemParser for Var {
fn parse(
cursor: clang::Cursor,
@ -138,6 +193,8 @@ impl ClangSubItemParser for Var {
use clang_sys::*;
match cursor.kind() {
CXCursor_MacroDefinition => {
let tokens: Vec<_> = cursor.tokens().iter().collect();
if let Some(callbacks) = ctx.parse_callbacks() {
match callbacks.will_parse_macro(&cursor.spelling()) {
MacroParsingBehavior::Ignore => {
@ -145,9 +202,11 @@ impl ClangSubItemParser for Var {
}
MacroParsingBehavior::Default => {}
}
handle_function_macro(&cursor, &tokens, callbacks)?;
}
let value = parse_macro(ctx, &cursor);
let value = parse_macro(ctx, &tokens);
let (id, value) = match value {
Some(v) => v,
@ -209,7 +268,7 @@ impl ClangSubItemParser for Var {
.parse_callbacks()
.and_then(|c| c.int_macro(&name, value))
.unwrap_or_else(|| {
default_macro_constant_type(value)
default_macro_constant_type(&ctx, value)
});
(TypeKind::Int(kind), VarType::Int(value))
@ -314,11 +373,14 @@ impl ClangSubItemParser for Var {
/// Try and parse a macro using all the macros parsed until now.
fn parse_macro(
ctx: &BindgenContext,
cursor: &clang::Cursor,
tokens: &[ClangToken],
) -> Option<(Vec<u8>, cexpr::expr::EvalResult)> {
use cexpr::expr;
let mut cexpr_tokens = cursor.cexpr_tokens();
let mut cexpr_tokens: Vec<_> = tokens
.iter()
.filter_map(ClangToken::as_cexpr_token)
.collect();
let parser = expr::IdentifierParser::new(ctx.parsed_macros());

547
third_party/rust/bindgen/src/lib.rs поставляемый
Просмотреть файл

@ -17,23 +17,10 @@
#[macro_use]
extern crate bitflags;
extern crate cexpr;
#[macro_use]
#[allow(unused_extern_crates)]
extern crate cfg_if;
extern crate clang_sys;
extern crate lazycell;
extern crate rustc_hash;
#[macro_use]
extern crate lazy_static;
extern crate peeking_take_while;
#[macro_use]
extern crate quote;
extern crate proc_macro2;
extern crate regex;
extern crate shlex;
#[cfg(feature = "which-rustfmt")]
extern crate which;
#[cfg(feature = "logging")]
#[macro_use]
@ -54,14 +41,10 @@ mod extra_assertions;
// we don't expose internals to library consumers.
macro_rules! doc_mod {
($m:ident, $doc_mod_name:ident) => {
cfg_if! {
if #[cfg(feature = "testing_only_docs")] {
pub mod $doc_mod_name {
//! Autogenerated documentation module.
pub use super::$m::*;
}
} else {
}
#[cfg(feature = "testing_only_docs")]
pub mod $doc_mod_name {
//! Autogenerated documentation module.
pub use super::$m::*;
}
};
}
@ -82,13 +65,15 @@ doc_mod!(ir, ir_docs);
doc_mod!(parse, parse_docs);
doc_mod!(regex_set, regex_set_docs);
pub use codegen::{AliasVariation, EnumVariation};
use features::RustFeatures;
pub use features::{RustTarget, LATEST_STABLE_RUST, RUST_TARGET_STRINGS};
use ir::context::{BindgenContext, ItemId};
use ir::item::Item;
use parse::{ClangItemParser, ParseError};
use regex_set::RegexSet;
pub use crate::codegen::{AliasVariation, EnumVariation, MacroTypeVariation};
use crate::features::RustFeatures;
pub use crate::features::{
RustTarget, LATEST_STABLE_RUST, RUST_TARGET_STRINGS,
};
use crate::ir::context::{BindgenContext, ItemId};
use crate::ir::item::Item;
use crate::parse::{ClangItemParser, ParseError};
use crate::regex_set::RegexSet;
use std::borrow::Cow;
use std::fs::{File, OpenOptions};
@ -102,6 +87,9 @@ type HashMap<K, V> = ::rustc_hash::FxHashMap<K, V>;
type HashSet<K> = ::rustc_hash::FxHashSet<K>;
pub(crate) use std::collections::hash_map::Entry;
/// Default prefix for the anon fields.
pub const DEFAULT_ANON_FIELDS_PREFIX: &'static str = "__bindgen_anon_";
fn args_are_cpp(clang_args: &[String]) -> bool {
return clang_args
.windows(2)
@ -199,6 +187,21 @@ impl Default for CodegenConfig {
/// 4. Rustified enum
///
/// If none of the above patterns match, then bindgen will generate a set of Rust constants.
///
/// # Clang arguments
///
/// Extra arguments can be passed to with clang:
/// 1. [`clang_arg()`](#method.clang_arg): takes a single argument
/// 2. [`clang_args()`](#method.clang_args): takes an iterator of arguments
/// 3. `BINDGEN_EXTRA_CLANG_ARGS` environment variable: whitespace separate
/// environment variable of arguments
///
/// Clang arguments specific to your crate should be added via the
/// `clang_arg()`/`clang_args()` methods.
///
/// End-users of the crate may need to set the `BINDGEN_EXTRA_CLANG_ARGS` environment variable to
/// add additional arguments. For example, to build against a different sysroot a user could set
/// `BINDGEN_EXTRA_CLANG_ARGS` to `--sysroot=/path/to/sysroot`.
#[derive(Debug, Default)]
pub struct Builder {
options: BindgenOptions,
@ -225,8 +228,17 @@ impl Builder {
output_vector.push("--rust-target".into());
output_vector.push(self.options.rust_target.into());
// FIXME(emilio): This is a bit hacky, maybe we should stop re-using the
// RustFeatures to store the "disable_untagged_union" call, and make it
// a different flag that we check elsewhere / in generate().
if !self.options.rust_features.untagged_union &&
RustFeatures::from(self.options.rust_target).untagged_union
{
output_vector.push("--disable-untagged-union".into());
}
if self.options.default_enum_style != Default::default() {
output_vector.push("--default-enum-style=".into());
output_vector.push("--default-enum-style".into());
output_vector.push(
match self.options.default_enum_style {
codegen::EnumVariation::Rust {
@ -248,131 +260,54 @@ impl Builder {
)
}
self.options
.bitfield_enums
.get_items()
.iter()
.map(|item| {
output_vector.push("--bitfield-enum".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.newtype_enums
.get_items()
.iter()
.map(|item| {
output_vector.push("--newtype-enum".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.rustified_enums
.get_items()
.iter()
.map(|item| {
output_vector.push("--rustified-enum".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.rustified_non_exhaustive_enums
.get_items()
.iter()
.map(|item| {
output_vector.push("--rustified-enum-non-exhaustive".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.constified_enum_modules
.get_items()
.iter()
.map(|item| {
output_vector.push("--constified-enum-module".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.constified_enums
.get_items()
.iter()
.map(|item| {
output_vector.push("--constified-enum".into());
output_vector.push(item.to_owned());
})
.count();
if self.options.default_macro_constant_type != Default::default() {
output_vector.push("--default-macro-constant-type".into());
output_vector
.push(self.options.default_macro_constant_type.as_str().into());
}
if self.options.default_alias_style != Default::default() {
output_vector.push("--default-alias-style=".into());
output_vector.push("--default-alias-style".into());
output_vector
.push(self.options.default_alias_style.as_str().into());
}
self.options
.type_alias
.get_items()
.iter()
.map(|item| {
output_vector.push("--type-alias".into());
output_vector.push(item.to_owned());
})
.count();
let regex_sets = &[
(&self.options.bitfield_enums, "--bitfield-enum"),
(&self.options.newtype_enums, "--newtype-enum"),
(&self.options.rustified_enums, "--rustified-enum"),
(
&self.options.rustified_non_exhaustive_enums,
"--rustified-enum-non-exhaustive",
),
(
&self.options.constified_enum_modules,
"--constified-enum-module",
),
(&self.options.constified_enums, "--constified-enum"),
(&self.options.type_alias, "--type-alias"),
(&self.options.new_type_alias, "--new-type-alias"),
(&self.options.new_type_alias_deref, "--new-type-alias-deref"),
(&self.options.blacklisted_types, "--blacklist-type"),
(&self.options.blacklisted_functions, "--blacklist-function"),
(&self.options.blacklisted_items, "--blacklist-item"),
(&self.options.opaque_types, "--opaque-type"),
(&self.options.whitelisted_functions, "--whitelist-function"),
(&self.options.whitelisted_types, "--whitelist-type"),
(&self.options.whitelisted_vars, "--whitelist-var"),
(&self.options.no_partialeq_types, "--no-partialeq"),
(&self.options.no_copy_types, "--no-copy"),
(&self.options.no_debug_types, "--no-debug"),
(&self.options.no_default_types, "--no-default"),
(&self.options.no_hash_types, "--no-hash"),
];
self.options
.new_type_alias
.get_items()
.iter()
.map(|item| {
output_vector.push("--new-type-alias".into());
for (set, flag) in regex_sets {
for item in set.get_items() {
output_vector.push((*flag).to_owned());
output_vector.push(item.to_owned());
})
.count();
self.options
.new_type_alias_deref
.get_items()
.iter()
.map(|item| {
output_vector.push("--new-type-alias-deref".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.blacklisted_types
.get_items()
.iter()
.map(|item| {
output_vector.push("--blacklist-type".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.blacklisted_functions
.get_items()
.iter()
.map(|item| {
output_vector.push("--blacklist-function".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.blacklisted_items
.get_items()
.iter()
.map(|item| {
output_vector.push("--blacklist-item".into());
output_vector.push(item.to_owned());
})
.count();
}
}
if !self.options.layout_tests {
output_vector.push("--no-layout-tests".into());
@ -453,6 +388,11 @@ impl Builder {
output_vector.push(prefix.clone());
}
if self.options.anon_fields_prefix != DEFAULT_ANON_FIELDS_PREFIX {
output_vector.push("--anon-fields-prefix".into());
output_vector.push(self.options.anon_fields_prefix.clone());
}
if self.options.emit_ast {
output_vector.push("--emit-clang-ast".into());
}
@ -477,6 +417,10 @@ impl Builder {
output_vector.push("--disable-nested-struct-naming".into());
}
if self.options.disable_header_comment {
output_vector.push("--disable-header-comment".into());
}
if !self.options.codegen_config.functions() {
output_vector.push("--ignore-functions".into());
}
@ -529,24 +473,10 @@ impl Builder {
output_vector.push(wasm_import_module_name.clone());
}
self.options
.opaque_types
.get_items()
.iter()
.map(|item| {
output_vector.push("--opaque-type".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.raw_lines
.iter()
.map(|item| {
output_vector.push("--raw-line".into());
output_vector.push(item.to_owned());
})
.count();
for line in &self.options.raw_lines {
output_vector.push("--raw-line".into());
output_vector.push(line.clone());
}
if self.options.use_core {
output_vector.push("--use-core".into());
@ -556,48 +486,8 @@ impl Builder {
output_vector.push("--conservative-inline-namespaces".into());
}
self.options
.whitelisted_functions
.get_items()
.iter()
.map(|item| {
output_vector.push("--whitelist-function".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.whitelisted_types
.get_items()
.iter()
.map(|item| {
output_vector.push("--whitelist-type".into());
output_vector.push(item.to_owned());
})
.count();
self.options
.whitelisted_vars
.get_items()
.iter()
.map(|item| {
output_vector.push("--whitelist-var".into());
output_vector.push(item.to_owned());
})
.count();
output_vector.push("--".into());
if !self.options.clang_args.is_empty() {
output_vector.extend(self.options.clang_args.iter().cloned());
}
if self.input_headers.len() > 1 {
output_vector.extend(
self.input_headers[..self.input_headers.len() - 1]
.iter()
.cloned(),
);
if self.options.generate_inline_functions {
output_vector.push("--generate-inline-functions".into());
}
if !self.options.record_matches {
@ -622,35 +512,28 @@ impl Builder {
output_vector.push(path.into());
}
self.options
.no_partialeq_types
.get_items()
.iter()
.map(|item| {
output_vector.push("--no-partialeq".into());
output_vector.push(item.to_owned());
})
.count();
if self.options.dynamic_library_name.is_some() {
let libname = self.options.dynamic_library_name.as_ref().unwrap();
output_vector.push("--dynamic-loading".into());
output_vector.push(libname.clone());
}
self.options
.no_copy_types
.get_items()
.iter()
.map(|item| {
output_vector.push("--no-copy".into());
output_vector.push(item.to_owned());
})
.count();
// Add clang arguments
self.options
.no_hash_types
.get_items()
.iter()
.map(|item| {
output_vector.push("--no-hash".into());
output_vector.push(item.to_owned());
})
.count();
output_vector.push("--".into());
if !self.options.clang_args.is_empty() {
output_vector.extend(self.options.clang_args.iter().cloned());
}
if self.input_headers.len() > 1 {
// To pass more than one header, we need to pass all but the last
// header via the `-include` clang arg
for header in &self.input_headers[..self.input_headers.len() - 1] {
output_vector.push("-include".to_string());
output_vector.push(header.clone());
}
}
output_vector
}
@ -705,6 +588,13 @@ impl Builder {
self
}
/// Disable insertion of bindgen's version identifier into generated
/// bindings.
pub fn disable_header_comment(mut self) -> Self {
self.options.disable_header_comment = true;
self
}
/// Set the output graphviz file.
pub fn emit_ir_graphviz<T: Into<String>>(mut self, path: T) -> Builder {
let path = path.into();
@ -712,14 +602,21 @@ impl Builder {
self
}
/// Whether the generated bindings should contain documentation comments or
/// not.
/// Whether the generated bindings should contain documentation comments
/// (docstrings) or not.
///
/// This ideally will always be true, but it may need to be false until we
/// implement some processing on comments to work around issues as described
/// in:
/// in [rust-bindgen issue
/// #426](https://github.com/rust-lang/rust-bindgen/issues/426).
///
/// https://github.com/rust-lang/rust-bindgen/issues/426
/// Note that clang by default excludes comments from system headers, pass
/// `-fretain-comments-from-system-headers` as
/// [`clang_arg`][Builder::clang_arg] to include them. It can also be told
/// to process all comments (not just documentation ones) using the
/// `-fparse-all-comments` flag. See [slides on clang comment parsing](
/// https://llvm.org/devmtg/2012-11/Gribenko_CommentParsing.pdf) for
/// background and examples.
pub fn generate_comments(mut self, doit: bool) -> Self {
self.options.generate_comments = doit;
self
@ -939,9 +836,9 @@ impl Builder {
/// This makes bindgen generate enums instead of constants. Regular
/// expressions are supported.
///
/// **Use this with caution,** you probably want to use the non_exhaustive
/// flavor of rust enums instead of this one. Take a look at
/// https://github.com/rust-lang/rust/issues/36927 for more information.
/// **Use this with caution**, creating this in unsafe code
/// (including FFI) with an invalid value will invoke undefined behaviour.
/// You may want to use the newtype enum style instead.
pub fn rustified_enum<T: AsRef<str>>(mut self, arg: T) -> Builder {
self.options.rustified_enums.insert(arg);
self
@ -952,6 +849,10 @@ impl Builder {
///
/// This makes bindgen generate enums instead of constants. Regular
/// expressions are supported.
///
/// **Use this with caution**, creating this in unsafe code
/// (including FFI) with an invalid value will invoke undefined behaviour.
/// You may want to use the newtype enum style instead.
pub fn rustified_non_exhaustive_enum<T: AsRef<str>>(
mut self,
arg: T,
@ -977,6 +878,15 @@ impl Builder {
self
}
/// Set the default type for macro constants
pub fn default_macro_constant_type(
mut self,
arg: codegen::MacroTypeVariation,
) -> Builder {
self.options.default_macro_constant_type = arg;
self
}
/// Set the default style of code to generate for typedefs
pub fn default_alias_style(
mut self,
@ -1325,6 +1235,12 @@ impl Builder {
self
}
/// Use the given prefix for the anon fields.
pub fn anon_fields_prefix<T: Into<String>>(mut self, prefix: T) -> Builder {
self.options.anon_fields_prefix = prefix.into();
self
}
/// Allows configuring types in different situations, see the
/// [`ParseCallbacks`](./callbacks/trait.ParseCallbacks.html) documentation.
pub fn parse_callbacks(
@ -1475,7 +1391,7 @@ impl Builder {
{
let mut wrapper_file = File::create(&wrapper_path)?;
wrapper_file.write(wrapper_contents.as_bytes())?;
wrapper_file.write_all(wrapper_contents.as_bytes())?;
}
let mut cmd = Command::new(&clang.path);
@ -1524,6 +1440,20 @@ impl Builder {
self
}
/// Don't derive `Debug` for a given type. Regular
/// expressions are supported.
pub fn no_debug<T: Into<String>>(mut self, arg: T) -> Self {
self.options.no_debug_types.insert(arg.into());
self
}
/// Don't derive/impl `Default` for a given type. Regular
/// expressions are supported.
pub fn no_default<T: Into<String>>(mut self, arg: T) -> Self {
self.options.no_default_types.insert(arg.into());
self
}
/// Don't derive `Hash` for a given type. Regular
/// expressions are supported.
pub fn no_hash<T: Into<String>>(mut self, arg: T) -> Builder {
@ -1545,6 +1475,15 @@ impl Builder {
self.options.wasm_import_module_name = Some(import_name.into());
self
}
/// Specify the dynamic library name if we are generating bindings for a shared library.
pub fn dynamic_library_name<T: Into<String>>(
mut self,
dynamic_library_name: T,
) -> Self {
self.options.dynamic_library_name = Some(dynamic_library_name.into());
self
}
}
/// Configuration options for generated bindings.
@ -1605,6 +1544,9 @@ struct BindgenOptions {
/// The enum patterns to mark an enum as a set of constants.
constified_enums: RegexSet,
/// The default type for C macro constants.
default_macro_constant_type: codegen::MacroTypeVariation,
/// The default style of code to generate for typedefs.
default_alias_style: codegen::AliasVariation,
@ -1644,6 +1586,9 @@ struct BindgenOptions {
/// True if we should avoid generating nested struct names.
disable_nested_struct_naming: bool,
/// True if we should avoid embedding version identifiers into source code.
disable_header_comment: bool,
/// True if we should generate layout tests for generated structures.
layout_tests: bool,
@ -1693,6 +1638,9 @@ struct BindgenOptions {
/// An optional prefix for the "raw" types, like `c_int`, `c_void`...
ctypes_prefix: Option<String>,
/// The prefix for the anon fields.
anon_fields_prefix: String,
/// Whether to time the bindgen phases.
time_phases: bool,
@ -1802,6 +1750,12 @@ struct BindgenOptions {
/// The set of types that we should not derive `Copy` for.
no_copy_types: RegexSet,
/// The set of types that we should not derive `Debug` for.
no_debug_types: RegexSet,
/// The set of types that we should not derive/impl `Default` for.
no_default_types: RegexSet,
/// The set of types that we should not derive `Hash` for.
no_hash_types: RegexSet,
@ -1810,6 +1764,10 @@ struct BindgenOptions {
/// Wasm import module name.
wasm_import_module_name: Option<String>,
/// The name of the dynamic library (if we are generating bindings for a shared library). If
/// this is None, no dynamic bindings are created.
dynamic_library_name: Option<String>,
}
/// TODO(emilio): This is sort of a lie (see the error message that results from
@ -1838,6 +1796,8 @@ impl BindgenOptions {
&mut self.new_type_alias_deref,
&mut self.no_partialeq_types,
&mut self.no_copy_types,
&mut self.no_debug_types,
&mut self.no_default_types,
&mut self.no_hash_types,
];
let record_matches = self.record_matches;
@ -1882,6 +1842,7 @@ impl Default for BindgenOptions {
rustified_non_exhaustive_enums: Default::default(),
constified_enums: Default::default(),
constified_enum_modules: Default::default(),
default_macro_constant_type: Default::default(),
default_alias_style: Default::default(),
type_alias: Default::default(),
new_type_alias: Default::default(),
@ -1905,8 +1866,10 @@ impl Default for BindgenOptions {
enable_function_attribute_detection: false,
disable_name_namespacing: false,
disable_nested_struct_naming: false,
disable_header_comment: false,
use_core: false,
ctypes_prefix: None,
anon_fields_prefix: DEFAULT_ANON_FIELDS_PREFIX.into(),
namespaced_constants: true,
msvc_mangling: false,
convert_floats: true,
@ -1934,9 +1897,12 @@ impl Default for BindgenOptions {
rustfmt_configuration_file: None,
no_partialeq_types: Default::default(),
no_copy_types: Default::default(),
no_debug_types: Default::default(),
no_default_types: Default::default(),
no_hash_types: Default::default(),
array_pointers_in_arguments: false,
wasm_import_module_name: None,
dynamic_library_name: None,
}
}
}
@ -1974,6 +1940,46 @@ pub struct Bindings {
module: proc_macro2::TokenStream,
}
pub(crate) const HOST_TARGET: &'static str =
include_str!(concat!(env!("OUT_DIR"), "/host-target.txt"));
// Some architecture triplets are different between rust and libclang, see #1211
// and duplicates.
fn rust_to_clang_target(rust_target: &str) -> String {
if rust_target.starts_with("aarch64-apple-") {
let mut clang_target = "arm64-apple-".to_owned();
clang_target.push_str(&rust_target["aarch64-apple-".len()..]);
return clang_target;
}
rust_target.to_owned()
}
/// Returns the effective target, and whether it was explicitly specified on the
/// clang flags.
fn find_effective_target(clang_args: &[String]) -> (String, bool) {
let mut args = clang_args.iter();
while let Some(opt) = args.next() {
if opt.starts_with("--target=") {
let mut split = opt.split('=');
split.next();
return (split.next().unwrap().to_owned(), true);
}
if opt == "-target" {
if let Some(target) = args.next() {
return (target.clone(), true);
}
}
}
// If we're running from a build script, try to find the cargo target.
if let Ok(t) = env::var("TARGET") {
return (rust_to_clang_target(&t), false);
}
(rust_to_clang_target(HOST_TARGET), false)
}
impl Bindings {
/// Generate bindings for the given options.
pub(crate) fn generate(
@ -1991,6 +1997,23 @@ impl Bindings {
options.build();
let (effective_target, explicit_target) =
find_effective_target(&options.clang_args);
let is_host_build =
rust_to_clang_target(HOST_TARGET) == effective_target;
// NOTE: The is_host_build check wouldn't be sound normally in some
// cases if we were to call a binary (if you have a 32-bit clang and are
// building on a 64-bit system for example). But since we rely on
// opening libclang.so, it has to be the same architecture and thus the
// check is fine.
if !explicit_target && !is_host_build {
options
.clang_args
.insert(0, format!("--target={}", effective_target));
};
fn detect_include_paths(options: &mut BindgenOptions) {
if !options.detect_include_paths {
return;
@ -2105,6 +2128,16 @@ impl Bindings {
let time_phases = options.time_phases;
let mut context = BindgenContext::new(options);
if is_host_build {
debug_assert_eq!(
context.target_pointer_size(),
std::mem::size_of::<*mut ()>(),
"{:?} {:?}",
effective_target,
HOST_TARGET
);
}
{
let _t = time::Timer::new("parse").with_output(time_phases);
parse(&mut context)?;
@ -2113,7 +2146,7 @@ impl Bindings {
let (items, options) = codegen::codegen(context);
Ok(Bindings {
options: options,
options,
module: quote! {
#( #items )*
},
@ -2142,31 +2175,36 @@ impl Bindings {
/// Write these bindings as source text to the given `Write`able.
pub fn write<'a>(&self, mut writer: Box<dyn Write + 'a>) -> io::Result<()> {
writer.write(
"/* automatically generated by rust-bindgen */\n\n".as_bytes(),
)?;
if !self.options.disable_header_comment {
let version = option_env!("CARGO_PKG_VERSION");
let header = format!(
"/* automatically generated by rust-bindgen {} */\n\n",
version.unwrap_or("(unknown version)")
);
writer.write_all(header.as_bytes())?;
}
for line in self.options.raw_lines.iter() {
writer.write(line.as_bytes())?;
writer.write("\n".as_bytes())?;
writer.write_all(line.as_bytes())?;
writer.write_all("\n".as_bytes())?;
}
if !self.options.raw_lines.is_empty() {
writer.write("\n".as_bytes())?;
writer.write_all("\n".as_bytes())?;
}
let bindings = self.module.to_string();
match self.rustfmt_generated_string(&bindings) {
Ok(rustfmt_bindings) => {
writer.write(rustfmt_bindings.as_bytes())?;
writer.write_all(rustfmt_bindings.as_bytes())?;
}
Err(err) => {
eprintln!(
"Failed to run rustfmt: {} (non-fatal, continuing)",
err
);
writer.write(bindings.as_bytes())?;
writer.write_all(bindings.as_bytes())?;
}
}
Ok(())
@ -2399,7 +2437,7 @@ impl callbacks::ParseCallbacks for CargoCallbacks {
#[test]
fn commandline_flag_unit_test_function() {
//Test 1
let bindings = ::builder();
let bindings = crate::builder();
let command_line_flags = bindings.command_line_flags();
let test_cases = vec![
@ -2417,7 +2455,7 @@ fn commandline_flag_unit_test_function() {
.all(|ref x| command_line_flags.contains(x),));
//Test 2
let bindings = ::builder()
let bindings = crate::builder()
.header("input_header")
.whitelist_type("Distinct_Type")
.whitelist_function("safe_function");
@ -2443,3 +2481,8 @@ fn commandline_flag_unit_test_function() {
.iter()
.all(|ref x| command_line_flags.contains(x),));
}
#[test]
fn test_rust_to_clang_target() {
assert_eq!(rust_to_clang_target("aarch64-apple-ios"), "arm64-apple-ios");
}

33
third_party/rust/bindgen/src/main.rs поставляемый
Просмотреть файл

@ -15,7 +15,7 @@ use std::panic;
mod log_stubs;
mod options;
use options::builder_from_flags;
use crate::options::builder_from_flags;
fn clang_version_check() {
let version = clang_version();
@ -27,8 +27,6 @@ fn clang_version_check() {
Some((4, 0))
} else if cfg!(feature = "testing_only_libclang_3_9") {
Some((3, 9))
} else if cfg!(feature = "testing_only_libclang_3_8") {
Some((3, 8))
} else {
None
};
@ -86,3 +84,32 @@ fn print_verbose_err() {
https://github.com/rust-lang/rust-bindgen/issues/new"
);
}
#[cfg(test)]
mod test {
fn build_flags_output_helper(builder: &bindgen::Builder) {
let mut command_line_flags = builder.command_line_flags();
command_line_flags.insert(0, "bindgen".to_string());
let flags_quoted: Vec<String> = command_line_flags
.iter()
.map(|x| format!("{}", shlex::quote(x)))
.collect();
let flags_str = flags_quoted.join(" ");
println!("{}", flags_str);
let (builder, _output, _verbose) =
crate::options::builder_from_flags(command_line_flags.into_iter())
.unwrap();
builder.generate().expect("failed to generate bindings");
}
#[test]
fn commandline_multiple_headers() {
let bindings = bindgen::Builder::default()
.header("tests/headers/char.h")
.header("tests/headers/func_ptr.h")
.header("tests/headers/16-byte-alignment.h");
build_flags_output_helper(&bindings);
}
}

78
third_party/rust/bindgen/src/options.rs поставляемый
Просмотреть файл

@ -1,5 +1,6 @@
use bindgen::{
builder, AliasVariation, Builder, CodegenConfig, EnumVariation, RustTarget,
builder, AliasVariation, Builder, CodegenConfig, EnumVariation,
MacroTypeVariation, RustTarget, DEFAULT_ANON_FIELDS_PREFIX,
RUST_TARGET_STRINGS,
};
use clap::{App, Arg};
@ -87,6 +88,13 @@ where
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("default-macro-constant-type")
.long("default-macro-constant-type")
.help("The default signed/unsigned type for C macro constants.")
.value_name("variant")
.default_value("unsigned")
.possible_values(&["signed", "unsigned"])
.multiple(false),
Arg::with_name("default-alias-style")
.long("default-alias-style")
.help("The default style of code used to generate typedefs.")
@ -234,6 +242,12 @@ where
)
.value_name("prefix")
.takes_value(true),
Arg::with_name("anon-fields-prefix")
.long("anon-fields-prefix")
.help("Use the given prefix for the anon fields.")
.value_name("prefix")
.default_value(DEFAULT_ANON_FIELDS_PREFIX)
.takes_value(true),
Arg::with_name("time-phases")
.long("time-phases")
.help("Time the different bindgen phases and print to stderr"),
@ -267,6 +281,15 @@ where
names like \"bar\" instead of \"foo_bar\" for a nested \
definition \"struct foo { struct bar { } b; };\"."
),
Arg::with_name("disable-untagged-union")
.long("disable-untagged-union")
.help(
"Disable support for native Rust unions.",
),
Arg::with_name("disable-header-comment")
.long("disable-header-comment")
.help("Suppress insertion of bindgen's version identifier into generated bindings.")
.multiple(true),
Arg::with_name("ignore-functions")
.long("ignore-functions")
.help(
@ -421,6 +444,20 @@ where
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("no-debug")
.long("no-debug")
.help("Avoid deriving Debug for types matching <regex>.")
.value_name("regex")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("no-default")
.long("no-default")
.help("Avoid deriving/implement Default for types matching <regex>.")
.value_name("regex")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("no-hash")
.long("no-hash")
.help("Avoid deriving Hash for types matching <regex>.")
@ -441,7 +478,11 @@ where
.long("wasm-import-module-name")
.value_name("name")
.takes_value(true)
.help("The name to be used in a #[link(wasm_import_module = ...)] statement")
.help("The name to be used in a #[link(wasm_import_module = ...)] statement"),
Arg::with_name("dynamic-loading")
.long("dynamic-loading")
.takes_value(true)
.help("Use dynamic loading mode with the given library name."),
]) // .args()
.get_matches_from(args);
@ -500,6 +541,11 @@ where
}
}
if let Some(variant) = matches.value_of("default-macro-constant-type") {
builder = builder
.default_macro_constant_type(MacroTypeVariation::from_str(variant)?)
}
if let Some(variant) = matches.value_of("default-alias-style") {
builder =
builder.default_alias_style(AliasVariation::from_str(variant)?);
@ -618,6 +664,10 @@ where
builder = builder.ctypes_prefix(prefix);
}
if let Some(prefix) = matches.value_of("anon-fields-prefix") {
builder = builder.anon_fields_prefix(prefix);
}
if let Some(what_to_generate) = matches.value_of("generate") {
let mut config = CodegenConfig::empty();
for what in what_to_generate.split(",") {
@ -667,6 +717,14 @@ where
builder = builder.disable_nested_struct_naming();
}
if matches.is_present("disable-untagged-union") {
builder = builder.disable_untagged_union();
}
if matches.is_present("disable-header-comment") {
builder = builder.disable_header_comment();
}
if matches.is_present("ignore-functions") {
builder = builder.ignore_functions();
}
@ -814,12 +872,28 @@ where
}
}
if let Some(no_debug) = matches.values_of("no-debug") {
for regex in no_debug {
builder = builder.no_debug(regex);
}
}
if let Some(no_default) = matches.values_of("no-default") {
for regex in no_default {
builder = builder.no_default(regex);
}
}
if let Some(no_hash) = matches.values_of("no-hash") {
for regex in no_hash {
builder = builder.no_hash(regex);
}
}
if let Some(dynamic_library_name) = matches.value_of("dynamic-loading") {
builder = builder.dynamic_library_name(dynamic_library_name);
}
let verbose = matches.is_present("verbose");
Ok((builder, output, verbose))

6
third_party/rust/bindgen/src/parse.rs поставляемый
Просмотреть файл

@ -1,8 +1,8 @@
//! Common traits and types related to parsing our IR from Clang cursors.
use clang;
use ir::context::{BindgenContext, ItemId, TypeId};
use ir::ty::TypeKind;
use crate::clang;
use crate::ir::context::{BindgenContext, ItemId, TypeId};
use crate::ir::ty::TypeKind;
/// Not so much an error in the traditional sense, but a control flow message
/// when walking over Clang's AST with a cursor.

2
third_party/rust/bindgen/src/regex_set.rs поставляемый
Просмотреть файл

@ -58,7 +58,7 @@ impl RegexSet {
self.set = match RxSet::new(items) {
Ok(x) => Some(x),
Err(e) => {
error!("Invalid regex in {:?}: {:?}", self.items, e);
warn!("Invalid regex in {:?}: {:?}", self.items, e);
None
}
}

Просмотреть файл

@ -1 +1 @@
{"files":{"CHANGELOG.md":"fd58c20190e7e58c35cfd6d19810bb90105d98024a98c7beac3bf6f08878f498","Cargo.toml":"021b9974c21a0d3caa0e18fb4c670a73b1ee2c79284757fc0bc510c837a7f91c","LICENSE.txt":"3ddf9be5c28fe27dad143a5dc76eea25222ad1dd68934a047064e56ed2fa40c5","README.md":"b08a3079aed4d36d46822bf8db01cd0e07420a2f46289e9bc0062b130cd471ce","appveyor.yml":"1a5d6953fb6e373dc760d50659628f04d48f68bd3f3f8e434800b31e74ef1497","build.rs":"2693b9519440c2341fe51e8eef4ca63de31a93cadc30366e25788e8c3ed0a29a","build/common.rs":"c3e37974f698aa38f7a3012c03edadd14a3fcd3a27a008f55b6a2348539f471c","build/dynamic.rs":"32cff0b28aefdad4516ba8d295f3b3b1aaee99f41d1fda1561333b85f54ffbb0","build/static.rs":"acefad54c29b6e361bfb29696098779ea477c51ff09cd4c3d0195a9ded7d8f60","ci/before_install.sh":"cb6de6f230066004f568d0b5e9d940b3793ff8ee7eb5d35a4f9ec777ee369725","ci/install.bat":"a011e1b3b15db83d134675ceca9e769b1593e283fcea7f4835142af962f407b0","ci/script.sh":"52db533df970f1b44c0b2663f3bfac4476f2150e94fc392b2bab4145325f418b","ci/test_script.bat":"901609adc59dab2730e16dd374d0351d6406e7559fe4d86ddd9a857ad9c84d2a","clippy.toml":"fcf54943ba571514b244cc098ce08671b4117167733e8107e799d533a12a2195","src/lib.rs":"c80d69431089b85e7392be55687ec9c87bf20962afdfda16c6b9810cdc33688a","src/link.rs":"7af2af3940a649b069ea25ef119acbc03649285b3ff7de6485913bcdf512d64e","src/support.rs":"fc58df47c3b75e0f1a3e5d5303ee2e638cec9d6abbf1507c2cff7073062f0569","tests/header.h":"1b15a686d1c06561960045a26c25a34d840f26c8246f2f5e630f993b69c7492c","tests/lib.rs":"8a71eafaa28b66fc0f7fe2235ce0d91cdc50cb148a84aa2baa8a696b0f9d80ee"},"package":"f92986241798376849e1a007827041fed9bb36195822c2049d18e174420e0534"}
{"files":{"CHANGELOG.md":"e33fd868e5b8d73d2eed0aa038f274849051f96f939b8ae9d81fc54e189423d3","Cargo.toml":"1145e02b69063643b930b1e5f1d135a62792d786ad9ebfccce35a96b08d7d6e2","LICENSE.txt":"3ddf9be5c28fe27dad143a5dc76eea25222ad1dd68934a047064e56ed2fa40c5","README.md":"7ce5a881f2c3d3c32d481e802edcf8c96f929e1759ec22b5e4d81657661ec6c8","build.rs":"2693b9519440c2341fe51e8eef4ca63de31a93cadc30366e25788e8c3ed0a29a","build/common.rs":"0b1f13d735071f310e5e2b0a18081281350517fdd2f74cbdbbe5e3f5af84f13c","build/dynamic.rs":"38ce27d706f8d11a13409395f3be5e8a7fbfb28e3d70f6109fe9d78df5ac063b","build/static.rs":"936e47effd9150ce9fbff78c0a15db0f1db20a10f9525852f0a5a216590cc9a0","clippy.toml":"fcf54943ba571514b244cc098ce08671b4117167733e8107e799d533a12a2195","src/lib.rs":"5de1679bb5cb060fa6f39e27c8f584d62a3036dda283abe2e300e4514602fba0","src/link.rs":"a9d00cc5484b42e275fa8e4dc6ef9afd9d36ba2bf1f6f411766630b702736537","src/support.rs":"2d4e11fe5b867757c063a5db505247d26789848754c7f4d36f00de996eb76dab","tests/header.h":"1b15a686d1c06561960045a26c25a34d840f26c8246f2f5e630f993b69c7492c","tests/lib.rs":"5af5536c51850f388bba4b60a8185b80c126f2f4574bc48287579cc1492ce3df"},"package":"0659001ab56b791be01d4b729c44376edc6718cf389a502e579b77b758f3296c"}

44
third_party/rust/clang-sys/CHANGELOG.md поставляемый
Просмотреть файл

@ -1,3 +1,47 @@
## [1.0.3] - 2020-11-19
### Fixed
- Fixed `Clang::find` panicking when `llvm-config` or `xcode-build` don't output anything to `stdout`
## [1.0.2] - 2020-11-17
### Fixed
- Fixed `Clang::find` to properly search directories returned by the
`llvm-config --bindir` and `xcodebuild -find clang` commands
- Improved version selection algorithm in the case where there are multiple
instances of `libclang` with the highest version found; previously the lowest
priority instance would be selected instead of the highest priority instance
(e.g., the versions found by searching the fallback directories were preferred
over the versions found by searching the `llvm-config --prefix` directory)
## [1.0.1] - 2020-10-01
### Changed
- Improved panic error message when calling an unloaded function
## [1.0.0] - 2020-07-14
### Changed
- Bumped `libloading` version to `0.6.0`
- Updated build script to not print warnings about failures to execute
`llvm-config` and `xcode-select` unless an instance of `libclang` is not found
### Added
- Added support for `clang` 10.0.x
### Removed
- Removed `gte_clang_*` Cargo features (these were an implementation detail)
## [0.29.3] - 2020-03-31
### Added
- Added ability to determine version of runtime-linked instance of `libclang`
## [0.29.2] - 2020-03-09
### Added
- Revert unnecessary increase of minimum version of `libc` and `libloading`
## [0.29.2] - 2020-03-09
### Added

39
third_party/rust/clang-sys/Cargo.toml поставляемый
Просмотреть файл

@ -12,15 +12,17 @@
[package]
name = "clang-sys"
version = "0.29.2"
version = "1.0.3"
authors = ["Kyle Mayes <kyle@mayeses.com>"]
build = "build.rs"
links = "clang"
description = "Rust bindings for libclang."
documentation = "https://kylemayes.github.io/clang-sys/3_5/clang_sys"
documentation = "https://docs.rs/clang-sys"
readme = "README.md"
license = "Apache-2.0"
repository = "https://github.com/KyleMayes/clang-sys"
[package.metadata.docs.rs]
features = ["clang_10_0", "runtime"]
[dependencies.glob]
version = "0.3"
@ -29,32 +31,23 @@ version = "0.2.39"
default-features = false
[dependencies.libloading]
version = "0.5"
version = "0.6"
optional = true
[build-dependencies.glob]
version = "0.3"
[features]
clang_10_0 = ["clang_9_0"]
clang_3_5 = []
clang_3_6 = ["gte_clang_3_6"]
clang_3_7 = ["gte_clang_3_6", "gte_clang_3_7"]
clang_3_8 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8"]
clang_3_9 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9"]
clang_4_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9", "gte_clang_4_0"]
clang_5_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9", "gte_clang_4_0", "gte_clang_5_0"]
clang_6_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9", "gte_clang_4_0", "gte_clang_5_0", "gte_clang_6_0"]
clang_7_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9", "gte_clang_4_0", "gte_clang_5_0", "gte_clang_6_0", "gte_clang_7_0"]
clang_8_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9", "gte_clang_4_0", "gte_clang_5_0", "gte_clang_6_0", "gte_clang_7_0", "gte_clang_8_0"]
clang_9_0 = ["gte_clang_3_6", "gte_clang_3_7", "gte_clang_3_8", "gte_clang_3_9", "gte_clang_4_0", "gte_clang_5_0", "gte_clang_6_0", "gte_clang_7_0", "gte_clang_8_0", "gte_clang_9_0"]
gte_clang_3_6 = []
gte_clang_3_7 = []
gte_clang_3_8 = []
gte_clang_3_9 = []
gte_clang_4_0 = []
gte_clang_5_0 = []
gte_clang_6_0 = []
gte_clang_7_0 = []
gte_clang_8_0 = []
gte_clang_9_0 = []
clang_3_6 = ["clang_3_5"]
clang_3_7 = ["clang_3_6"]
clang_3_8 = ["clang_3_7"]
clang_3_9 = ["clang_3_8"]
clang_4_0 = ["clang_3_9"]
clang_5_0 = ["clang_4_0"]
clang_6_0 = ["clang_5_0"]
clang_7_0 = ["clang_6_0"]
clang_8_0 = ["clang_7_0"]
clang_9_0 = ["clang_8_0"]
runtime = ["libloading"]
static = []

35
third_party/rust/clang-sys/README.md поставляемый
Просмотреть файл

@ -1,8 +1,8 @@
# clang-sys
[![crates.io](https://img.shields.io/crates/v/clang-sys.svg)](https://crates.io/crates/clang-sys)
[![Travis CI](https://travis-ci.org/KyleMayes/clang-sys.svg?branch=master)](https://travis-ci.org/KyleMayes/clang-sys)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/7tv5mjyg55rof356/branch/master?svg=true)](https://ci.appveyor.com/project/KyleMayes/clang-sys-vtvy5/branch/master)
[![Crate](https://img.shields.io/crates/v/clang-sys.svg)](https://crates.io/crates/clang-sys)
[![Documentation](https://docs.rs/clang-sys/badge.svg)](https://docs.rs/clang-sys)
[![CI](https://github.com/KyleMayes/clang-sys/workflows/CI/badge.svg?branch=master)](https://github.com/KyleMayes/clang-sys/actions?query=workflow%3ACI)
Rust bindings for `libclang`.
@ -10,36 +10,41 @@ If you are interested in a Rust wrapper for these bindings, see
[clang-rs](https://github.com/KyleMayes/clang-rs).
Supported on the stable, beta, and nightly Rust channels.<br/>
Minimum supported Rust version: **1.36.0**
Minimum supported Rust version: **1.40.0**
Released under the Apache License 2.0.
## Documentation
There are two versions of the documentation, one for the API exposed when
linking dynamically or statically and one for the API exposed when linking at
runtime (see the
[Dependencies](https://github.com/KyleMayes/clang-sys#dependencies) section
of the README for more information on the linking options).
The only difference between the APIs exposed is that when linking at runtime a
few additional types and functions are exposed to manage the loaded `libclang`
shared library.
* Runtime - [Documentation](https://kylemayes.github.io/clang-sys/runtime/clang_sys)
* Dynamic / Static - [Documentation](https://kylemayes.github.io/clang-sys/default/clang_sys)
## Supported Versions
To target a version of `libclang`, enable one of the following Cargo features:
* `clang_3_5` - requires `libclang` 3.5 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_5/clang_sys))
* `clang_3_6` - requires `libclang` 3.6 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_6/clang_sys))
* `clang_3_7` - requires `libclang` 3.7 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_7/clang_sys))
* `clang_3_8` - requires `libclang` 3.8 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_8/clang_sys))
* `clang_3_9` - requires `libclang` 3.9 or later
([Documentation](https://kylemayes.github.io/clang-sys/3_9/clang_sys))
* `clang_4_0` - requires `libclang` 4.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/4_0/clang_sys))
* `clang_5_0` - requires `libclang` 5.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/5_0/clang_sys))
* `clang_6_0` - requires `libclang` 6.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/6_0/clang_sys))
* `clang_7_0` - requires `libclang` 7.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/7_0/clang_sys))
* `clang_8_0` - requires `libclang` 8.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/8_0/clang_sys))
* `clang_9_0` - requires `libclang` 9.0 or later
([Documentation](https://kylemayes.github.io/clang-sys/9_0/clang_sys))
* `clang_10_0` - requires `libclang` 10.0 or later
If you do not enable one of these features, the API provided by `libclang` 3.5 will be available by
default.

12
third_party/rust/clang-sys/appveyor.yml поставляемый
Просмотреть файл

@ -1,12 +0,0 @@
environment:
matrix:
- LLVM_VERSION: 7.0.0
CLANG_VERSION: clang_7_0
install:
- .\ci\install.bat
build: false
test_script:
- .\ci\test_script.bat

85
third_party/rust/clang-sys/build/common.rs поставляемый
Просмотреть файл

@ -14,6 +14,8 @@
extern crate glob;
use std::cell::RefCell;
use std::collections::HashMap;
use std::env;
use std::path::{Path, PathBuf};
use std::process::Command;
@ -46,30 +48,38 @@ const DIRECTORIES_WINDOWS: &[&str] = &[
"C:\\MSYS*\\MinGW*\\lib",
];
thread_local! {
/// The errors encountered when attempting to execute console commands.
static COMMAND_ERRORS: RefCell<HashMap<String, Vec<String>>> = RefCell::default();
}
/// Executes the supplied console command, returning the `stdout` output if the
/// command was successfully executed.
fn run_command(command: &str, arguments: &[&str]) -> Option<String> {
macro_rules! warn {
($error:expr) => {
println!(
"cargo:warning=couldn't execute `{} {}` ({})",
command,
arguments.join(" "),
$error,
);
};
fn run_command(name: &str, command: &str, arguments: &[&str]) -> Option<String> {
macro_rules! error {
($error:expr) => {{
COMMAND_ERRORS.with(|e| e.borrow_mut()
.entry(name.into())
.or_insert_with(Vec::new)
.push(format!(
"couldn't execute `{} {}` ({})",
command,
arguments.join(" "),
$error,
)));
}};
}
let output = match Command::new(command).args(arguments).output() {
Ok(output) => output,
Err(error) => {
warn!(format!("error: {}", error));
error!(format!("error: {}", error));
return None;
}
};
if !output.status.success() {
warn!(format!("exit code: {}", output.status));
error!(format!("exit code: {}", output.status));
return None;
}
@ -80,17 +90,50 @@ fn run_command(command: &str, arguments: &[&str]) -> Option<String> {
/// successfully executed.
pub fn run_llvm_config(arguments: &[&str]) -> Option<String> {
let path = env::var("LLVM_CONFIG_PATH").unwrap_or_else(|_| "llvm-config".into());
run_command("llvm-config", &path, arguments)
}
let output = run_command(&path, arguments);
if output.is_none() {
println!(
"cargo:warning=set the LLVM_CONFIG_PATH environment variable to \
the full path to a valid `llvm-config` executable (including the \
executable itself)"
);
/// A struct that prints errors encountered when attempting to execute console
/// commands on drop if not discarded.
#[derive(Default)]
pub struct CommandErrorPrinter {
discard: bool
}
impl CommandErrorPrinter {
pub fn discard(mut self) {
self.discard = true;
}
}
output
impl Drop for CommandErrorPrinter {
fn drop(&mut self) {
if self.discard {
return;
}
let errors = COMMAND_ERRORS.with(|e| e.borrow().clone());
if let Some(errors) = errors.get("llvm-config") {
println!(
"cargo:warning=could not execute `llvm-config` one or more \
times, if the LLVM_CONFIG_PATH environment variable is set to \
a full path to valid `llvm-config` executable it will be used \
to try to find an instance of `libclang` on your system: {}",
errors.iter().map(|e| format!("\"{}\"", e)).collect::<Vec<_>>().join("\n "),
)
}
if let Some(errors) = errors.get("xcode-select") {
println!(
"cargo:warning=could not execute `xcode-select` one or more \
times, if a valid instance of this executable is on your PATH \
it will be used to try to find an instance of `libclang` on \
your system: {}",
errors.iter().map(|e| format!("\"{}\"", e)).collect::<Vec<_>>().join("\n "),
)
}
}
}
/// Returns the paths to and the filenames of the files matching the supplied
@ -179,7 +222,7 @@ pub fn search_libclang_directories(files: &[String], variable: &str) -> Vec<(Pat
// Search the toolchain directory in the directory provided by
// `xcode-select --print-path`.
if cfg!(target_os = "macos") {
if let Some(output) = run_command("xcode-select", &["--print-path"]) {
if let Some(output) = run_command("xcode-select", "xcode-select", &["--print-path"]) {
let directory = Path::new(output.lines().next().unwrap()).to_path_buf();
let directory = directory.join("Toolchains/XcodeDefault.xctoolchain/usr/lib");
found.extend(search_directories(&directory, files));

18
third_party/rust/clang-sys/build/dynamic.rs поставляемый
Просмотреть файл

@ -181,6 +181,20 @@ fn search_libclang_directories(runtime: bool) -> Result<Vec<(PathBuf, String, Ve
pub fn find(runtime: bool) -> Result<(PathBuf, String), String> {
search_libclang_directories(runtime)?
.iter()
// We want to find the `libclang` shared library with the highest
// version number, hence `max_by_key` below.
//
// However, in the case where there are multiple such `libclang` shared
// libraries, we want to use the order in which they appeared in the
// list returned by `search_libclang_directories` as a tiebreaker since
// that function returns `libclang` shared libraries in descending order
// of preference by how they were found.
//
// `max_by_key`, perhaps surprisingly, returns the *last* item with the
// maximum key rather than the first which results in the opposite of
// the tiebreaking behavior we want. This is easily fixed by reversing
// the list first.
.rev()
.max_by_key(|f| &f.2)
.cloned()
.map(|(path, filename, _)| (path, filename))
@ -190,6 +204,8 @@ pub fn find(runtime: bool) -> Result<(PathBuf, String), String> {
/// Find and link to `libclang` dynamically.
#[cfg(not(feature = "runtime"))]
pub fn link() {
let cep = common::CommandErrorPrinter::default();
use std::fs;
let (directory, filename) = find(false).unwrap();
@ -241,4 +257,6 @@ pub fn link() {
println!("cargo:rustc-link-lib=dylib={}", name);
}
cep.discard();
}

6
third_party/rust/clang-sys/build/static.rs поставляемый
Просмотреть файл

@ -90,7 +90,7 @@ fn find() -> PathBuf {
};
let files = common::search_libclang_directories(&[name.into()], "LIBCLANG_STATIC_PATH");
if let Some((directory, _)) = files.into_iter().nth(0) {
if let Some((directory, _)) = files.into_iter().next() {
directory
} else {
panic!("could not find any static libraries");
@ -99,6 +99,8 @@ fn find() -> PathBuf {
/// Find and link to `libclang` statically.
pub fn link() {
let cep = common::CommandErrorPrinter::default();
let directory = find();
// Specify required Clang static libraries.
@ -133,4 +135,6 @@ pub fn link() {
} else if cfg!(target_os = "macos") {
println!("cargo:rustc-flags=-l ffi -l ncurses -l c++ -l z");
}
cep.discard();
}

Просмотреть файл

@ -1,57 +0,0 @@
set -e
pushd ~
# Workaround for Travis CI macOS bug (https://github.com/travis-ci/travis-ci/issues/6307)
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
rvm get head || true
fi
function llvm_version_triple() {
if [ "$1" == "3.5" ]; then
echo "3.5.2"
elif [ "$1" == "3.6" ]; then
echo "3.6.2"
elif [ "$1" == "3.7" ]; then
echo "3.7.1"
elif [ "$1" == "3.8" ]; then
echo "3.8.1"
elif [ "$1" == "3.9" ]; then
echo "3.9.0"
elif [ "$1" == "4.0" ]; then
echo "4.0.1"
elif [ "$1" == "5.0" ]; then
echo "5.0.2"
elif [ "$1" == "6.0" ]; then
echo "6.0.1"
elif [ "$1" == "7.0" ]; then
echo "7.0.0"
fi
}
function llvm_download() {
export LLVM_VERSION_TRIPLE=`llvm_version_triple ${LLVM_VERSION}`
export LLVM=clang+llvm-${LLVM_VERSION_TRIPLE}-$1
export LLVM_DIRECTORY="$HOME/.llvm/${LLVM}"
if [ -d "${LLVM_DIRECTORY}" ]; then
echo "Using cached LLVM download for ${LLVM}..."
else
wget http://releases.llvm.org/${LLVM_VERSION_TRIPLE}/${LLVM}.tar.xz
mkdir -p "${LLVM_DIRECTORY}"
tar xf ${LLVM}.tar.xz -C "${LLVM_DIRECTORY}" --strip-components=1
fi
export LLVM_CONFIG_PATH="${LLVM_DIRECTORY}/bin/llvm-config"
}
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
llvm_download x86_64-linux-gnu-ubuntu-14.04
export LD_LIBRARY_PATH="${LLVM_DIRECTORY}/lib":$LD_LIBRARY_PATH
else
llvm_download x86_64-apple-darwin
cp "${LLVM_DIRECTORY}/lib/libclang.dylib" /usr/local/lib/libclang.dylib
export DYLD_LIBRARY_PATH="${LLVM_DIRECTORY}/lib":$DYLD_LIBRARY_PATH
fi
popd
set +e

8
third_party/rust/clang-sys/ci/install.bat поставляемый
Просмотреть файл

@ -1,8 +0,0 @@
curl -sSf https://static.rust-lang.org/dist/rust-1.36.0-i686-pc-windows-msvc.exe -o rust.exe
rust.exe /VERYSILENT /NORESTART /DIR="C:\Rust"
set PATH=%PATH%;C:\Rust\bin
curl -sSf http://releases.llvm.org/%LLVM_VERSION%/LLVM-%LLVM_VERSION%-win32.exe -o LLVM.exe
7z x LLVM.exe -oC:\LLVM
set PATH=%PATH%;C:\LLVM\bin
set LIBCLANG_PATH=C:\LLVM\bin

13
third_party/rust/clang-sys/ci/script.sh поставляемый
Просмотреть файл

@ -1,13 +0,0 @@
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
rvm get head || true
fi
set -e
RUST_BACKTRACE=1 cargo test --verbose --features $CLANG_VERSION -- --nocapture
if [ "${CLANG_VERSION}" \< "clang_3_7" ]; then
RUST_BACKTRACE=1 cargo test --verbose --features "$CLANG_VERSION static" -- --nocapture
fi
RUST_BACKTRACE=1 cargo test --verbose --features "$CLANG_VERSION runtime" -- --nocapture

Просмотреть файл

@ -1,2 +0,0 @@
set RUST_BACKTRACE=1
cargo test --verbose --features %CLANG_VERSION% -- --nocapture

341
third_party/rust/clang-sys/src/lib.rs поставляемый
Просмотреть файл

@ -14,19 +14,20 @@
//! Rust bindings for `libclang`.
//!
//! ## Supported Versions
//! ## Documentation
//!
//! * 3.5 - [Documentation](https://kylemayes.github.io/clang-sys/3_5/clang_sys)
//! * 3.6 - [Documentation](https://kylemayes.github.io/clang-sys/3_6/clang_sys)
//! * 3.7 - [Documentation](https://kylemayes.github.io/clang-sys/3_7/clang_sys)
//! * 3.8 - [Documentation](https://kylemayes.github.io/clang-sys/3_8/clang_sys)
//! * 3.9 - [Documentation](https://kylemayes.github.io/clang-sys/3_9/clang_sys)
//! * 4.0 - [Documentation](https://kylemayes.github.io/clang-sys/4_0/clang_sys)
//! * 5.0 - [Documentation](https://kylemayes.github.io/clang-sys/5_0/clang_sys)
//! * 6.0 - [Documentation](https://kylemayes.github.io/clang-sys/6_0/clang_sys)
//! * 7.0 - [Documentation](https://kylemayes.github.io/clang-sys/7_0/clang_sys)
//! * 8.0 - [Documentation](https://kylemayes.github.io/clang-sys/8_0/clang_sys)
//! * 9.0 - [Documentation](https://kylemayes.github.io/clang-sys/9_0/clang_sys)
//! There are two versions of the documentation, one for the API exposed when
//! linking dynamically or statically and one for the API exposed when linking
//! at runtime (see the
//! [Dependencies](https://github.com/KyleMayes/clang-sys#dependencies) section
//! of the README for more information on the linking options).
//!
//! The only difference between the APIs exposed is that when linking at runtime
//! a few additional types and functions are exposed to manage the loaded
//! `libclang` shared library.
//!
//! * Runtime - [Documentation](https://kylemayes.github.io/clang-sys/runtime/clang_sys)
//! * Dynamic / Static - [Documentation](https://kylemayes.github.io/clang-sys/default/clang_sys)
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::unreadable_literal))]
@ -47,7 +48,7 @@ use libc::*;
pub type CXClientData = *mut c_void;
pub type CXCursorVisitor = extern "C" fn(CXCursor, CXCursor, CXClientData) -> CXChildVisitResult;
#[cfg(feature = "gte_clang_3_7")]
#[cfg(feature = "clang_3_7")]
pub type CXFieldVisitor = extern "C" fn(CXCursor, CXClientData) -> CXVisitorResult;
pub type CXInclusionVisitor = extern "C" fn(CXFile, *mut CXSourceLocation, c_uint, CXClientData);
@ -437,6 +438,16 @@ cenum! {
const CXCursor_OMPTargetTeamsDistributeSimdDirective = 279,
/// Only produced by 'libclang' 9.0 and later.
const CXCursor_BuiltinBitCastExpr = 280,
/// Only produced by `libclang` 10.0 and later.
const CXCursor_OMPMasterTaskLoopDirective = 281,
/// Only produced by `libclang` 10.0 and later.
const CXCursor_OMPParallelMasterTaskLoopDirective = 282,
/// Only produced by `libclang` 10.0 and later.
const CXCursor_OMPMasterTaskLoopSimdDirective = 283,
/// Only produced by `libclang` 10.0 and later.
const CXCursor_OMPParallelMasterTaskLoopSimdDirective = 284,
/// Only produced by `libclang` 10.0 and later.
const CXCursor_OMPParallelMasterDirective = 285,
const CXCursor_TranslationUnit = 300,
const CXCursor_UnexposedAttr = 400,
const CXCursor_IBActionAttr = 401,
@ -524,7 +535,8 @@ cenum! {
}
cenum! {
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
enum CXCursor_ExceptionSpecificationKind {
const CXCursor_ExceptionSpecificationKind_None = 0,
const CXCursor_ExceptionSpecificationKind_DynamicNone = 1,
@ -535,7 +547,8 @@ cenum! {
const CXCursor_ExceptionSpecificationKind_Unevaluated = 6,
const CXCursor_ExceptionSpecificationKind_Uninstantiated = 7,
const CXCursor_ExceptionSpecificationKind_Unparsed = 8,
#[cfg(feature="gte_clang_9_0")]
/// Only available on `libclang` 9.0 and later.
#[cfg(feature = "clang_9_0")]
const CXCursor_ExceptionSpecificationKind_NoThrow = 9,
}
}
@ -677,7 +690,8 @@ cenum! {
}
cenum! {
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
enum CXPrintingPolicyProperty {
const CXPrintingPolicy_Indentation = 0,
const CXPrintingPolicy_SuppressSpecifiers = 1,
@ -734,7 +748,8 @@ cenum! {
}
cenum! {
#[cfg(feature="gte_clang_6_0")]
/// Only available on `libclang` 6.0 and later.
#[cfg(feature = "clang_6_0")]
enum CXTLSKind {
const CXTLS_None = 0,
const CXTLS_Dynamic = 1,
@ -762,7 +777,8 @@ cenum! {
}
cenum! {
#[cfg(feature="gte_clang_3_6")]
/// Only available on `libclang` 3.6 and later.
#[cfg(feature = "clang_3_6")]
enum CXTemplateArgumentKind {
const CXTemplateArgumentKind_Null = 0,
const CXTemplateArgumentKind_Type = 1,
@ -989,7 +1005,8 @@ cenum! {
}
cenum! {
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
enum CXVisibilityKind {
const CXVisibility_Invalid = 0,
const CXVisibility_Hidden = 1,
@ -999,7 +1016,8 @@ cenum! {
}
cenum! {
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
enum CXTypeNullabilityKind {
const CXTypeNullability_NonNull = 0,
const CXTypeNullability_Nullable = 1,
@ -1025,7 +1043,8 @@ cenum! {
}
cenum! {
#[cfg(feature="gte_clang_3_6")]
/// Only available on `libclang` 3.6 and later.
#[cfg(feature = "clang_3_6")]
enum CX_StorageClass {
const CX_SC_Invalid = 0,
const CX_SC_None = 1,
@ -1154,7 +1173,8 @@ cenum! {
const CXObjCPropertyAttr_weak = 512;
const CXObjCPropertyAttr_strong = 1024;
const CXObjCPropertyAttr_unsafe_unretained = 2048;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
const CXObjCPropertyAttr_class = 4096;
}
}
@ -1172,7 +1192,8 @@ cenum! {
}
cenum! {
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
enum CXSymbolRole {
const CXSymbolRole_None = 0;
const CXSymbolRole_Declaration = 1;
@ -1198,20 +1219,30 @@ cenum! {
const CXTranslationUnit_CXXChainedPCH = 32;
const CXTranslationUnit_SkipFunctionBodies = 64;
const CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 128;
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
const CXTranslationUnit_CreatePreambleOnFirstParse = 256;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
const CXTranslationUnit_KeepGoing = 512;
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
const CXTranslationUnit_SingleFileParse = 1024;
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
const CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 2048;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
const CXTranslationUnit_IncludeAttributedTypes = 4096;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
const CXTranslationUnit_VisitImplicitAttributes = 8192;
#[cfg(feature="gte_clang_9_0")]
/// Only available on `libclang` 9.0 and later.
#[cfg(feature = "clang_9_0")]
const CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 16384;
/// Only available on `libclang` 10.0 and later.
#[cfg(feature = "clang_10_0")]
const CXTranslationUnit_RetainExcludedConditionalBlocks = 32768;
}
}
@ -1234,7 +1265,7 @@ opaque!(CXCompletionString);
opaque!(CXCursorSet);
opaque!(CXDiagnostic);
opaque!(CXDiagnosticSet);
#[cfg(feature = "gte_clang_3_9")]
#[cfg(feature = "clang_3_9")]
opaque!(CXEvalResult);
opaque!(CXFile);
opaque!(CXIdxClientASTFile);
@ -1244,10 +1275,10 @@ opaque!(CXIdxClientFile);
opaque!(CXIndex);
opaque!(CXIndexAction);
opaque!(CXModule);
#[cfg(feature = "gte_clang_7_0")]
#[cfg(feature = "clang_7_0")]
opaque!(CXPrintingPolicy);
opaque!(CXRemapping);
#[cfg(feature = "gte_clang_5_0")]
#[cfg(feature = "clang_5_0")]
opaque!(CXTargetInfo);
opaque!(CXTranslationUnit);
@ -1389,7 +1420,8 @@ pub struct CXIdxEntityRefInfo {
pub referencedEntity: *const CXIdxEntityInfo,
pub parentEntity: *const CXIdxEntityInfo,
pub container: *const CXIdxContainerInfo,
#[cfg(feature = "gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
pub role: CXSymbolRole,
}
@ -1549,7 +1581,7 @@ pub struct CXString {
default!(CXString);
#[cfg(feature = "gte_clang_3_8")]
#[cfg(feature = "clang_3_8")]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct CXStringSet {
@ -1557,7 +1589,7 @@ pub struct CXStringSet {
pub Count: c_uint,
}
#[cfg(feature = "gte_clang_3_8")]
#[cfg(feature = "clang_3_8")]
default!(CXStringSet);
#[derive(Copy, Clone, Debug)]
@ -1642,25 +1674,33 @@ link! {
pub fn clang_CXCursorSet_insert(set: CXCursorSet, cursor: CXCursor) -> c_uint;
pub fn clang_CXIndex_getGlobalOptions(index: CXIndex) -> CXGlobalOptFlags;
pub fn clang_CXIndex_setGlobalOptions(index: CXIndex, flags: CXGlobalOptFlags);
#[cfg(feature="gte_clang_6_0")]
/// Only available on `libclang` 6.0 and later.
#[cfg(feature = "clang_6_0")]
pub fn clang_CXIndex_setInvocationEmissionPathOption(index: CXIndex, path: *const c_char);
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_CXXConstructor_isConvertingConstructor(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_CXXConstructor_isCopyConstructor(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_CXXConstructor_isDefaultConstructor(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_CXXConstructor_isMoveConstructor(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
pub fn clang_CXXField_isMutable(cursor: CXCursor) -> c_uint;
pub fn clang_CXXMethod_isConst(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_CXXMethod_isDefaulted(cursor: CXCursor) -> c_uint;
pub fn clang_CXXMethod_isPureVirtual(cursor: CXCursor) -> c_uint;
pub fn clang_CXXMethod_isStatic(cursor: CXCursor) -> c_uint;
pub fn clang_CXXMethod_isVirtual(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_6_0")]
/// Only available on `libclang` 6.0 and later.
#[cfg(feature = "clang_6_0")]
pub fn clang_CXXRecord_isAbstract(cursor: CXCursor) -> c_uint;
pub fn clang_CompilationDatabase_dispose(database: CXCompilationDatabase);
pub fn clang_CompilationDatabase_fromDirectory(directory: *const c_char, error: *mut CXCompilationDatabase_Error) -> CXCompilationDatabase;
@ -1668,97 +1708,132 @@ link! {
pub fn clang_CompilationDatabase_getCompileCommands(database: CXCompilationDatabase, filename: *const c_char) -> CXCompileCommands;
pub fn clang_CompileCommand_getArg(command: CXCompileCommand, index: c_uint) -> CXString;
pub fn clang_CompileCommand_getDirectory(command: CXCompileCommand) -> CXString;
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
pub fn clang_CompileCommand_getFilename(command: CXCompileCommand) -> CXString;
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
pub fn clang_CompileCommand_getMappedSourceContent(command: CXCompileCommand, index: c_uint) -> CXString;
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
pub fn clang_CompileCommand_getMappedSourcePath(command: CXCompileCommand, index: c_uint) -> CXString;
pub fn clang_CompileCommand_getNumArgs(command: CXCompileCommand) -> c_uint;
pub fn clang_CompileCommand_getNumMappedSources(command: CXCompileCommand) -> c_uint;
pub fn clang_CompileCommands_dispose(command: CXCompileCommands);
pub fn clang_CompileCommands_getCommand(command: CXCompileCommands, index: c_uint) -> CXCompileCommand;
pub fn clang_CompileCommands_getSize(command: CXCompileCommands) -> c_uint;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_Cursor_Evaluate(cursor: CXCursor) -> CXEvalResult;
pub fn clang_Cursor_getArgument(cursor: CXCursor, index: c_uint) -> CXCursor;
pub fn clang_Cursor_getBriefCommentText(cursor: CXCursor) -> CXString;
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
pub fn clang_Cursor_getCXXManglings(cursor: CXCursor) -> *mut CXStringSet;
pub fn clang_Cursor_getCommentRange(cursor: CXCursor) -> CXSourceRange;
#[cfg(feature="gte_clang_3_6")]
/// Only available on `libclang` 3.6 and later.
#[cfg(feature = "clang_3_6")]
pub fn clang_Cursor_getMangling(cursor: CXCursor) -> CXString;
pub fn clang_Cursor_getModule(cursor: CXCursor) -> CXModule;
pub fn clang_Cursor_getNumArguments(cursor: CXCursor) -> c_int;
#[cfg(feature="gte_clang_3_6")]
/// Only available on `libclang` 3.6 and later.
#[cfg(feature = "clang_3_6")]
pub fn clang_Cursor_getNumTemplateArguments(cursor: CXCursor) -> c_int;
pub fn clang_Cursor_getObjCDeclQualifiers(cursor: CXCursor) -> CXObjCDeclQualifierKind;
#[cfg(feature="gte_clang_6_0")]
/// Only available on `libclang` 6.0 and later.
#[cfg(feature = "clang_6_0")]
pub fn clang_Cursor_getObjCManglings(cursor: CXCursor) -> *mut CXStringSet;
pub fn clang_Cursor_getObjCPropertyAttributes(cursor: CXCursor, reserved: c_uint) -> CXObjCPropertyAttrKind;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
pub fn clang_Cursor_getObjCPropertyGetterName(cursor: CXCursor) -> CXString;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
pub fn clang_Cursor_getObjCPropertySetterName(cursor: CXCursor) -> CXString;
pub fn clang_Cursor_getObjCSelectorIndex(cursor: CXCursor) -> c_int;
#[cfg(feature="gte_clang_3_7")]
/// Only available on `libclang` 3.7 and later.
#[cfg(feature = "clang_3_7")]
pub fn clang_Cursor_getOffsetOfField(cursor: CXCursor) -> c_longlong;
#[cfg(feature="gte_clang_9_0")]
/// Only available on `libclang` 9.0 and later.
#[cfg(feature = "clang_9_0")]
pub fn clang_Cursor_isAnonymousRecordDecl(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_9_0")]
/// Only available on `libclang` 9.0 and later.
#[cfg(feature = "clang_9_0")]
pub fn clang_Cursor_isInlineNamespace(cursor: CXCursor) -> c_uint;
pub fn clang_Cursor_getRawCommentText(cursor: CXCursor) -> CXString;
pub fn clang_Cursor_getReceiverType(cursor: CXCursor) -> CXType;
pub fn clang_Cursor_getSpellingNameRange(cursor: CXCursor, index: c_uint, reserved: c_uint) -> CXSourceRange;
#[cfg(feature="gte_clang_3_6")]
/// Only available on `libclang` 3.6 and later.
#[cfg(feature = "clang_3_6")]
pub fn clang_Cursor_getStorageClass(cursor: CXCursor) -> CX_StorageClass;
#[cfg(feature="gte_clang_3_6")]
/// Only available on `libclang` 3.6 and later.
#[cfg(feature = "clang_3_6")]
pub fn clang_Cursor_getTemplateArgumentKind(cursor: CXCursor, index: c_uint) -> CXTemplateArgumentKind;
#[cfg(feature="gte_clang_3_6")]
/// Only available on `libclang` 3.6 and later.
#[cfg(feature = "clang_3_6")]
pub fn clang_Cursor_getTemplateArgumentType(cursor: CXCursor, index: c_uint) -> CXType;
#[cfg(feature="gte_clang_3_6")]
/// Only available on `libclang` 3.6 and later.
#[cfg(feature = "clang_3_6")]
pub fn clang_Cursor_getTemplateArgumentUnsignedValue(cursor: CXCursor, index: c_uint) -> c_ulonglong;
#[cfg(feature="gte_clang_3_6")]
/// Only available on `libclang` 3.6 and later.
#[cfg(feature = "clang_3_6")]
pub fn clang_Cursor_getTemplateArgumentValue(cursor: CXCursor, index: c_uint) -> c_longlong;
pub fn clang_Cursor_getTranslationUnit(cursor: CXCursor) -> CXTranslationUnit;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_Cursor_hasAttrs(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_3_7")]
/// Only available on `libclang` 3.7 and later.
#[cfg(feature = "clang_3_7")]
pub fn clang_Cursor_isAnonymous(cursor: CXCursor) -> c_uint;
pub fn clang_Cursor_isBitField(cursor: CXCursor) -> c_uint;
pub fn clang_Cursor_isDynamicCall(cursor: CXCursor) -> c_int;
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_Cursor_isExternalSymbol(cursor: CXCursor, language: *mut CXString, from: *mut CXString, generated: *mut c_uint) -> c_uint;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_Cursor_isFunctionInlined(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_Cursor_isMacroBuiltin(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_Cursor_isMacroFunctionLike(cursor: CXCursor) -> c_uint;
pub fn clang_Cursor_isNull(cursor: CXCursor) -> c_int;
pub fn clang_Cursor_isObjCOptional(cursor: CXCursor) -> c_uint;
pub fn clang_Cursor_isVariadic(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_EnumDecl_isScoped(cursor: CXCursor) -> c_uint;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_EvalResult_dispose(result: CXEvalResult);
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_EvalResult_getAsDouble(result: CXEvalResult) -> libc::c_double;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_EvalResult_getAsInt(result: CXEvalResult) -> c_int;
#[cfg(feature="gte_clang_4_0")]
/// Only available on `libclang` 4.0 and later.
#[cfg(feature = "clang_4_0")]
pub fn clang_EvalResult_getAsLongLong(result: CXEvalResult) -> c_longlong;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_EvalResult_getAsStr(result: CXEvalResult) -> *const c_char;
#[cfg(feature="gte_clang_4_0")]
/// Only available on `libclang` 4.0 and later.
#[cfg(feature = "clang_4_0")]
pub fn clang_EvalResult_getAsUnsigned(result: CXEvalResult) -> c_ulonglong;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_EvalResult_getKind(result: CXEvalResult) -> CXEvalResultKind;
#[cfg(feature="gte_clang_4_0")]
/// Only available on `libclang` 4.0 and later.
#[cfg(feature = "clang_4_0")]
pub fn clang_EvalResult_isUnsignedInt(result: CXEvalResult) -> c_uint;
#[cfg(feature="gte_clang_3_6")]
/// Only available on `libclang` 3.6 and later.
#[cfg(feature = "clang_3_6")]
pub fn clang_File_isEqual(left: CXFile, right: CXFile) -> c_int;
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
pub fn clang_File_tryGetRealPathName(file: CXFile) -> CXString;
pub fn clang_IndexAction_create(index: CXIndex) -> CXIndexAction;
pub fn clang_IndexAction_dispose(index: CXIndexAction);
@ -1771,47 +1846,64 @@ link! {
pub fn clang_Module_getParent(module: CXModule) -> CXModule;
pub fn clang_Module_getTopLevelHeader(tu: CXTranslationUnit, module: CXModule, index: c_uint) -> CXFile;
pub fn clang_Module_isSystem(module: CXModule) -> c_int;
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
pub fn clang_PrintingPolicy_dispose(policy: CXPrintingPolicy);
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
pub fn clang_PrintingPolicy_getProperty(policy: CXPrintingPolicy, property: CXPrintingPolicyProperty) -> c_uint;
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
pub fn clang_PrintingPolicy_setProperty(policy: CXPrintingPolicy, property: CXPrintingPolicyProperty, value: c_uint);
pub fn clang_Range_isNull(range: CXSourceRange) -> c_int;
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_TargetInfo_dispose(info: CXTargetInfo);
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_TargetInfo_getPointerWidth(info: CXTargetInfo) -> c_int;
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_TargetInfo_getTriple(info: CXTargetInfo) -> CXString;
pub fn clang_Type_getAlignOf(type_: CXType) -> c_longlong;
pub fn clang_Type_getCXXRefQualifier(type_: CXType) -> CXRefQualifierKind;
pub fn clang_Type_getClassType(type_: CXType) -> CXType;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_Type_getNamedType(type_: CXType) -> CXType;
pub fn clang_Type_getNumTemplateArguments(type_: CXType) -> c_int;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
pub fn clang_Type_getObjCObjectBaseType(type_: CXType) -> CXType;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
pub fn clang_Type_getNumObjCProtocolRefs(type_: CXType) -> c_uint;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
pub fn clang_Type_getObjCProtocolDecl(type_: CXType, index: c_uint) -> CXCursor;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
pub fn clang_Type_getNumObjCTypeArgs(type_: CXType) -> c_uint;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
pub fn clang_Type_getObjCTypeArg(type_: CXType, index: c_uint) -> CXType;
#[cfg(feature="gte_clang_3_9")]
/// Only available on `libclang` 3.9 and later.
#[cfg(feature = "clang_3_9")]
pub fn clang_Type_getObjCEncoding(type_: CXType) -> CXString;
pub fn clang_Type_getOffsetOf(type_: CXType, field: *const c_char) -> c_longlong;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
pub fn clang_Type_getModifiedType(type_: CXType) -> CXType;
pub fn clang_Type_getSizeOf(type_: CXType) -> c_longlong;
pub fn clang_Type_getTemplateArgumentAsType(type_: CXType, index: c_uint) -> CXType;
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_Type_isTransparentTagTypedef(type_: CXType) -> c_uint;
#[cfg(feature="gte_clang_8_0")]
/// Only available on `libclang` 8.0 and later.
#[cfg(feature = "clang_8_0")]
pub fn clang_Type_getNullability(type_: CXType) -> CXTypeNullabilityKind;
#[cfg(feature="gte_clang_3_7")]
/// Only available on `libclang` 3.7 and later.
#[cfg(feature = "clang_3_7")]
pub fn clang_Type_visitFields(type_: CXType, visitor: CXFieldVisitor, data: CXClientData) -> CXVisitorResult;
pub fn clang_annotateTokens(tu: CXTranslationUnit, tokens: *mut CXToken, n_tokens: c_uint, cursors: *mut CXCursor);
pub fn clang_codeCompleteAt(tu: CXTranslationUnit, file: *const c_char, line: c_uint, column: c_uint, unsaved: *mut CXUnsavedFile, n_unsaved: c_uint, flags: CXCodeComplete_Flags) -> *mut CXCodeCompleteResults;
@ -1847,7 +1939,8 @@ link! {
pub fn clang_disposeOverriddenCursors(cursors: *mut CXCursor);
pub fn clang_disposeSourceRangeList(list: *mut CXSourceRangeList);
pub fn clang_disposeString(string: CXString);
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
pub fn clang_disposeStringSet(set: *mut CXStringSet);
pub fn clang_disposeTokens(tu: CXTranslationUnit, tokens: *mut CXToken, n_tokens: c_uint);
pub fn clang_disposeTranslationUnit(tu: CXTranslationUnit);
@ -1860,11 +1953,14 @@ link! {
pub fn clang_findIncludesInFile(tu: CXTranslationUnit, file: CXFile, cursor: CXCursorAndRangeVisitor) -> CXResult;
pub fn clang_findReferencesInFile(cursor: CXCursor, file: CXFile, visitor: CXCursorAndRangeVisitor) -> CXResult;
pub fn clang_formatDiagnostic(diagnostic: CXDiagnostic, flags: CXDiagnosticDisplayOptions) -> CXString;
#[cfg(feature="gte_clang_3_7")]
/// Only available on `libclang` 3.7 and later.
#[cfg(feature = "clang_3_7")]
pub fn clang_free(buffer: *mut c_void);
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_getAddressSpace(type_: CXType) -> c_uint;
#[cfg(feature="gte_clang_4_0")]
/// Only available on `libclang` 4.0 and later.
#[cfg(feature = "clang_4_0")]
pub fn clang_getAllSkippedRanges(tu: CXTranslationUnit) -> *mut CXSourceRangeList;
pub fn clang_getArgType(type_: CXType, index: c_uint) -> CXType;
pub fn clang_getArrayElementType(type_: CXType) -> CXType;
@ -1882,10 +1978,12 @@ link! {
pub fn clang_getCompletionChunkCompletionString(string: CXCompletionString, index: c_uint) -> CXCompletionString;
pub fn clang_getCompletionChunkKind(string: CXCompletionString, index: c_uint) -> CXCompletionChunkKind;
pub fn clang_getCompletionChunkText(string: CXCompletionString, index: c_uint) -> CXString;
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
pub fn clang_getCompletionFixIt(results: *mut CXCodeCompleteResults, completion_index: c_uint, fixit_index: c_uint, range: *mut CXSourceRange) -> CXString;
pub fn clang_getCompletionNumAnnotations(string: CXCompletionString) -> c_uint;
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
pub fn clang_getCompletionNumFixIts(results: *mut CXCodeCompleteResults, completion_index: c_uint) -> c_uint;
pub fn clang_getCompletionParent(string: CXCompletionString, kind: *mut CXCursorKind) -> CXString;
pub fn clang_getCompletionPriority(string: CXCompletionString) -> c_uint;
@ -1894,7 +1992,8 @@ link! {
pub fn clang_getCursorCompletionString(cursor: CXCursor) -> CXCompletionString;
pub fn clang_getCursorDefinition(cursor: CXCursor) -> CXCursor;
pub fn clang_getCursorDisplayName(cursor: CXCursor) -> CXString;
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_getCursorExceptionSpecificationType(cursor: CXCursor) -> CXCursor_ExceptionSpecificationKind;
pub fn clang_getCursorExtent(cursor: CXCursor) -> CXSourceRange;
pub fn clang_getCursorKind(cursor: CXCursor) -> CXCursorKind;
@ -1904,20 +2003,24 @@ link! {
pub fn clang_getCursorLinkage(cursor: CXCursor) -> CXLinkageKind;
pub fn clang_getCursorLocation(cursor: CXCursor) -> CXSourceLocation;
pub fn clang_getCursorPlatformAvailability(cursor: CXCursor, deprecated: *mut c_int, deprecated_message: *mut CXString, unavailable: *mut c_int, unavailable_message: *mut CXString, availability: *mut CXPlatformAvailability, n_availability: c_int) -> c_int;
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
pub fn clang_getCursorPrettyPrinted(cursor: CXCursor, policy: CXPrintingPolicy) -> CXString;
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
pub fn clang_getCursorPrintingPolicy(cursor: CXCursor) -> CXPrintingPolicy;
pub fn clang_getCursorReferenceNameRange(cursor: CXCursor, flags: CXNameRefFlags, index: c_uint) -> CXSourceRange;
pub fn clang_getCursorReferenced(cursor: CXCursor) -> CXCursor;
pub fn clang_getCursorResultType(cursor: CXCursor) -> CXType;
pub fn clang_getCursorSemanticParent(cursor: CXCursor) -> CXCursor;
pub fn clang_getCursorSpelling(cursor: CXCursor) -> CXString;
#[cfg(feature="gte_clang_6_0")]
/// Only available on `libclang` 6.0 and later.
#[cfg(feature = "clang_6_0")]
pub fn clang_getCursorTLSKind(cursor: CXCursor) -> CXTLSKind;
pub fn clang_getCursorType(cursor: CXCursor) -> CXType;
pub fn clang_getCursorUSR(cursor: CXCursor) -> CXString;
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
pub fn clang_getCursorVisibility(cursor: CXCursor) -> CXVisibilityKind;
pub fn clang_getDeclObjCTypeEncoding(cursor: CXCursor) -> CXString;
pub fn clang_getDefinitionSpellingAndExtent(cursor: CXCursor, start: *mut *const c_char, end: *mut *const c_char, start_line: *mut c_uint, start_column: *mut c_uint, end_line: *mut c_uint, end_column: *mut c_uint);
@ -1939,12 +2042,14 @@ link! {
pub fn clang_getEnumConstantDeclUnsignedValue(cursor: CXCursor) -> c_ulonglong;
pub fn clang_getEnumConstantDeclValue(cursor: CXCursor) -> c_longlong;
pub fn clang_getEnumDeclIntegerType(cursor: CXCursor) -> CXType;
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_getExceptionSpecificationType(type_: CXType) -> CXCursor_ExceptionSpecificationKind;
pub fn clang_getExpansionLocation(location: CXSourceLocation, file: *mut CXFile, line: *mut c_uint, column: *mut c_uint, offset: *mut c_uint);
pub fn clang_getFieldDeclBitWidth(cursor: CXCursor) -> c_int;
pub fn clang_getFile(tu: CXTranslationUnit, file: *const c_char) -> CXFile;
#[cfg(feature="gte_clang_6_0")]
/// Only available on `libclang` 6.0 and later.
#[cfg(feature = "clang_6_0")]
pub fn clang_getFileContents(tu: CXTranslationUnit, file: CXFile, size: *mut size_t) -> *const c_char;
pub fn clang_getFileLocation(location: CXSourceLocation, file: *mut CXFile, line: *mut c_uint, column: *mut c_uint, offset: *mut c_uint);
pub fn clang_getFileName(file: CXFile) -> CXString;
@ -1981,7 +2086,8 @@ link! {
pub fn clang_getSpecializedCursorTemplate(cursor: CXCursor) -> CXCursor;
pub fn clang_getSpellingLocation(location: CXSourceLocation, file: *mut CXFile, line: *mut c_uint, column: *mut c_uint, offset: *mut c_uint);
pub fn clang_getTUResourceUsageName(kind: CXTUResourceUsageKind) -> *const c_char;
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_getTranslationUnitTargetInfo(tu: CXTranslationUnit) -> CXTargetInfo;
pub fn clang_getTemplateCursorKind(cursor: CXCursor) -> CXCursorKind;
pub fn clang_getTokenExtent(tu: CXTranslationUnit, token: CXToken) -> CXSourceRange;
@ -1994,13 +2100,15 @@ link! {
pub fn clang_getTypeKindSpelling(type_: CXTypeKind) -> CXString;
pub fn clang_getTypeSpelling(type_: CXType) -> CXString;
pub fn clang_getTypedefDeclUnderlyingType(cursor: CXCursor) -> CXType;
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_getTypedefName(type_: CXType) -> CXString;
pub fn clang_hashCursor(cursor: CXCursor) -> c_uint;
pub fn clang_indexLoc_getCXSourceLocation(location: CXIdxLoc) -> CXSourceLocation;
pub fn clang_indexLoc_getFileLocation(location: CXIdxLoc, index_file: *mut CXIdxClientFile, file: *mut CXFile, line: *mut c_uint, column: *mut c_uint, offset: *mut c_uint);
pub fn clang_indexSourceFile(index: CXIndexAction, data: CXClientData, callbacks: *mut IndexerCallbacks, n_callbacks: c_uint, index_flags: CXIndexOptFlags, file: *const c_char, arguments: *const *const c_char, n_arguments: c_int, unsaved: *mut CXUnsavedFile, n_unsaved: c_uint, tu: *mut CXTranslationUnit, tu_flags: CXTranslationUnit_Flags) -> CXErrorCode;
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
pub fn clang_indexSourceFileFullArgv(index: CXIndexAction, data: CXClientData, callbacks: *mut IndexerCallbacks, n_callbacks: c_uint, index_flags: CXIndexOptFlags, file: *const c_char, arguments: *const *const c_char, n_arguments: c_int, unsaved: *mut CXUnsavedFile, n_unsaved: c_uint, tu: *mut CXTranslationUnit, tu_flags: CXTranslationUnit_Flags) -> CXErrorCode;
pub fn clang_indexTranslationUnit(index: CXIndexAction, data: CXClientData, callbacks: *mut IndexerCallbacks, n_callbacks: c_uint, flags: CXIndexOptFlags, tu: CXTranslationUnit) -> c_int;
pub fn clang_index_getCXXClassDeclInfo(info: *const CXIdxDeclInfo) -> *const CXIdxCXXClassDeclInfo;
@ -2023,7 +2131,8 @@ link! {
pub fn clang_isFileMultipleIncludeGuarded(tu: CXTranslationUnit, file: CXFile) -> c_uint;
pub fn clang_isFunctionTypeVariadic(type_: CXType) -> c_uint;
pub fn clang_isInvalid(kind: CXCursorKind) -> c_uint;
#[cfg(feature="gte_clang_7_0")]
/// Only available on `libclang` 7.0 and later.
#[cfg(feature = "clang_7_0")]
pub fn clang_isInvalidDeclaration(cursor: CXCursor) -> c_uint;
pub fn clang_isPODType(type_: CXType) -> c_uint;
pub fn clang_isPreprocessing(kind: CXCursorKind) -> c_uint;
@ -2037,7 +2146,8 @@ link! {
pub fn clang_loadDiagnostics(file: *const c_char, error: *mut CXLoadDiag_Error, message: *mut CXString) -> CXDiagnosticSet;
pub fn clang_parseTranslationUnit(index: CXIndex, file: *const c_char, arguments: *const *const c_char, n_arguments: c_int, unsaved: *mut CXUnsavedFile, n_unsaved: c_uint, flags: CXTranslationUnit_Flags) -> CXTranslationUnit;
pub fn clang_parseTranslationUnit2(index: CXIndex, file: *const c_char, arguments: *const *const c_char, n_arguments: c_int, unsaved: *mut CXUnsavedFile, n_unsaved: c_uint, flags: CXTranslationUnit_Flags, tu: *mut CXTranslationUnit) -> CXErrorCode;
#[cfg(feature="gte_clang_3_8")]
/// Only available on `libclang` 3.8 and later.
#[cfg(feature = "clang_3_8")]
pub fn clang_parseTranslationUnit2FullArgv(index: CXIndex, file: *const c_char, arguments: *const *const c_char, n_arguments: c_int, unsaved: *mut CXUnsavedFile, n_unsaved: c_uint, flags: CXTranslationUnit_Flags, tu: *mut CXTranslationUnit) -> CXErrorCode;
pub fn clang_remap_dispose(remapping: CXRemapping);
pub fn clang_remap_getFilenames(remapping: CXRemapping, index: c_uint, original: *mut CXString, transformed: *mut CXString);
@ -2045,7 +2155,8 @@ link! {
pub fn clang_reparseTranslationUnit(tu: CXTranslationUnit, n_unsaved: c_uint, unsaved: *mut CXUnsavedFile, flags: CXReparse_Flags) -> CXErrorCode;
pub fn clang_saveTranslationUnit(tu: CXTranslationUnit, file: *const c_char, options: CXSaveTranslationUnit_Flags) -> CXSaveError;
pub fn clang_sortCodeCompletionResults(results: *mut CXCompletionResult, n_results: c_uint);
#[cfg(feature="gte_clang_5_0")]
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_suspendTranslationUnit(tu: CXTranslationUnit) -> c_uint;
pub fn clang_toggleCrashRecovery(recovery: c_uint);
pub fn clang_tokenize(tu: CXTranslationUnit, range: CXSourceRange, tokens: *mut *mut CXToken, n_tokens: *mut c_uint);

125
third_party/rust/clang-sys/src/link.rs поставляемый
Просмотреть файл

@ -18,7 +18,13 @@
#[cfg(feature = "runtime")]
macro_rules! link {
(@LOAD: #[cfg($cfg:meta)] fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*) => (
(
@LOAD:
$(#[doc=$doc:expr])*
#[cfg($cfg:meta)]
fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*
) => (
$(#[doc=$doc])*
#[cfg($cfg)]
pub fn $name(library: &mut super::SharedLibrary) {
let symbol = unsafe { library.library.get(stringify!($name).as_bytes()) }.ok();
@ -32,19 +38,47 @@ macro_rules! link {
pub fn $name(_: &mut super::SharedLibrary) {}
);
(@LOAD: fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*) => (
link!(@LOAD: #[cfg(feature="runtime")] fn $name($($pname: $pty), *) $(-> $ret)*);
(
@LOAD:
fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*
) => (
link!(@LOAD: #[cfg(feature = "runtime")] fn $name($($pname: $pty), *) $(-> $ret)*);
);
($($(#[cfg($cfg:meta)])* pub fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*;)+) => (
(
$(
$(#[doc=$doc:expr] #[cfg($cfg:meta)])*
pub fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*;
)+
) => (
use std::cell::{RefCell};
use std::sync::{Arc};
use std::path::{Path, PathBuf};
/// The (minimum) version of a `libclang` shared library.
#[allow(missing_docs)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Version {
V3_5 = 35,
V3_6 = 36,
V3_7 = 37,
V3_8 = 38,
V3_9 = 39,
V4_0 = 40,
V5_0 = 50,
V6_0 = 60,
V7_0 = 70,
V8_0 = 80,
V9_0 = 90,
}
/// The set of functions loaded dynamically.
#[derive(Debug, Default)]
pub struct Functions {
$($(#[cfg($cfg)])* pub $name: Option<unsafe extern fn($($pname: $pty), *) $(-> $ret)*>,)+
$(
$(#[doc=$doc] #[cfg($cfg)])*
pub $name: Option<unsafe extern fn($($pname: $pty), *) $(-> $ret)*>,
)+
}
/// A dynamically loaded instance of the `libclang` library.
@ -60,9 +94,43 @@ macro_rules! link {
Self { library, path, functions: Functions::default() }
}
/// Returns the path to this `libclang` shared library.
pub fn path(&self) -> &Path {
&self.path
}
/// Returns the (minimum) version of this `libclang` shared library.
///
/// If this returns `None`, it indicates that the version is too old
/// to be supported by this crate (i.e., `3.4` or earlier). If the
/// version of this shared library is more recent than that fully
/// supported by this crate, the most recent fully supported version
/// will be returned.
pub fn version(&self) -> Option<Version> {
macro_rules! check {
($fn:expr, $version:ident) => {
if self.library.get::<unsafe extern fn()>($fn).is_ok() {
return Some(Version::$version);
}
};
}
unsafe {
check!(b"clang_Cursor_isAnonymousRecordDecl", V9_0);
check!(b"clang_Cursor_getObjCPropertyGetterName", V8_0);
check!(b"clang_File_tryGetRealPathName", V7_0);
check!(b"clang_CXIndex_setInvocationEmissionPathOption", V6_0);
check!(b"clang_Cursor_isExternalSymbol", V5_0);
check!(b"clang_EvalResult_getAsLongLong", V4_0);
check!(b"clang_CXXConstructor_isConvertingConstructor", V3_9);
check!(b"clang_CXXField_isMutable", V3_8);
check!(b"clang_Cursor_getOffsetOfField", V3_7);
check!(b"clang_Cursor_getStorageClass", V3_6);
check!(b"clang_Type_getNumTemplateArguments", V3_5);
}
None
}
}
thread_local!(static LIBRARY: RefCell<Option<Arc<SharedLibrary>>> = RefCell::new(None));
@ -82,19 +150,22 @@ macro_rules! link {
}
$(
#[cfg_attr(feature="cargo-clippy", allow(too_many_arguments))]
$(#[cfg($cfg)])*
#[cfg_attr(feature="cargo-clippy", allow(clippy::missing_safety_doc))]
#[cfg_attr(feature="cargo-clippy", allow(clippy::too_many_arguments))]
$(#[doc=$doc] #[cfg($cfg)])*
pub unsafe fn $name($($pname: $pty), *) $(-> $ret)* {
let f = with_library(|l| {
match l.functions.$name {
Some(f) => f,
_ => panic!(concat!("function not loaded: ", stringify!($name))),
}
l.functions.$name.expect(concat!(
"`libclang` function not loaded: `",
stringify!($name),
"`. This crate requires that `libclang` 3.9 or later be installed on your ",
"system. For more information on how to accomplish this, see here: ",
"https://rust-lang.github.io/rust-bindgen/requirements.html#installing-clang-39"))
}).expect("a `libclang` shared library is not loaded on this thread");
f($($pname), *)
}
$(#[cfg($cfg)])*
$(#[doc=$doc] #[cfg($cfg)])*
pub mod $name {
pub fn is_loaded() -> bool {
super::with_library(|l| l.functions.$name.is_some()).unwrap_or(false)
@ -121,7 +192,7 @@ macro_rules! link {
pub mod dynamic { include!(concat!(env!("OUT_DIR"), "/dynamic.rs")); }
}
let (directory, filename) = try!(build::dynamic::find(true));
let (directory, filename) = build::dynamic::find(true)?;
let path = directory.join(filename);
let library = libloading::Library::new(&path).map_err(|e| {
@ -132,7 +203,7 @@ macro_rules! link {
)
});
let mut library = SharedLibrary::new(try!(library), path);
let mut library = SharedLibrary::new(library?, path);
$(load::$name(&mut library);)+
Ok(library)
}
@ -150,7 +221,7 @@ macro_rules! link {
/// * the `libclang` shared library could not be opened
#[allow(dead_code)]
pub fn load() -> Result<(), String> {
let library = Arc::new(try!(load_manually()));
let library = Arc::new(load_manually()?);
LIBRARY.with(|l| *l.borrow_mut() = Some(library));
Ok(())
}
@ -187,12 +258,24 @@ macro_rules! link {
#[cfg(not(feature = "runtime"))]
macro_rules! link {
($($(#[cfg($cfg:meta)])* pub fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*;)+) => (
extern { $($(#[cfg($cfg)])* pub fn $name($($pname: $pty), *) $(-> $ret)*;)+ }
(
$(
$(#[doc=$doc:expr] #[cfg($cfg:meta)])*
pub fn $name:ident($($pname:ident: $pty:ty), *) $(-> $ret:ty)*;
)+
) => (
extern {
$(
$(#[doc=$doc] #[cfg($cfg)])*
pub fn $name($($pname: $pty), *) $(-> $ret)*;
)+
}
$($(#[cfg($cfg)])*
pub mod $name {
pub fn is_loaded() -> bool { true }
})+
$(
$(#[doc=$doc] #[cfg($cfg)])*
pub mod $name {
pub fn is_loaded() -> bool { true }
}
)+
)
}

10
third_party/rust/clang-sys/src/support.rs поставляемый
Просмотреть файл

@ -84,11 +84,15 @@ impl Clang {
paths.push(path.into());
}
if let Ok(path) = run_llvm_config(&["--bindir"]) {
paths.push(path.into());
if let Some(line) = path.lines().next() {
paths.push(line.into());
}
}
if cfg!(target_os = "macos") {
if let Ok((path, _)) = run("xcodebuild", &["-find", "clang"]) {
paths.push(path.into());
if let Some(line) = path.lines().next() {
paths.push(line.into());
}
}
}
paths.extend(env::split_paths(&env::var("PATH").unwrap()));
@ -181,7 +185,7 @@ fn parse_version_number(number: &str) -> Option<c_int> {
fn parse_version(path: &Path) -> Option<CXVersion> {
let output = run_clang(path, &["--version"]).0;
let start = try_opt!(output.find("version ")) + 8;
let mut numbers = try_opt!(output[start..].split_whitespace().nth(0)).split('.');
let mut numbers = try_opt!(output[start..].split_whitespace().next()).split('.');
let major = try_opt!(numbers.next().and_then(parse_version_number));
let minor = try_opt!(numbers.next().and_then(parse_version_number));
let subminor = numbers.next().and_then(parse_version_number).unwrap_or(0);

2
third_party/rust/clang-sys/tests/lib.rs поставляемый
Просмотреть файл

@ -29,6 +29,8 @@ fn parse() {
#[test]
fn test() {
load().unwrap();
let library = get_library().unwrap();
println!("{:?} ({:?})", library.version(), library.path());
parse();
unload().unwrap();
}

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"dc71730e83b7c4b4a7ac70614a707a48dcd1770934eb6f015854e23c6ddb30a6","LICENSE":"7576269ea71f767b99297934c0b2367532690f8c4badc695edf8e04ab6a1e545","README.md":"4712c7a0f626e72a87440871f4ae136d9b35c04a361c679139ad5da1dd32f534","build.rs":"04598eda39f81259d2dcb1a829be678b33ac9a5472b9a15ffc863ea2a6581735","src/lib.rs":"22c9dbbb1dc38d6f77b9362e806a7ee59a8ca1aa9b2c9344d1a487a91287ed59"},"package":"e81f1c165c33ffab90a03077ac3b03462b34d5947145dfa48102e063d581502c"}
{"files":{"Cargo.toml":"aa7a2eef3c054f7e85d333f9eaad07b360ab7548facd12c960003961964fe4f8","LICENSE":"7576269ea71f767b99297934c0b2367532690f8c4badc695edf8e04ab6a1e545","README.md":"a8adeaf1947035175b890109b36604ac3676f887911b5b8debd216689c0b65bd","build.rs":"92378306b530db031b825425870ace29acb9d4398ede04901b3c9407cab52c1b","src/lib.rs":"22c9dbbb1dc38d6f77b9362e806a7ee59a8ca1aa9b2c9344d1a487a91287ed59"},"package":"2b7e3347be6a09b46aba228d6608386739fb70beff4f61e07422da87b0bb31fa"}

8
third_party/rust/coreaudio-sys/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package]
name = "coreaudio-sys"
version = "0.2.4"
version = "0.2.8"
authors = ["Mitchell Nordine <mitchell.nordine@gmail.com>"]
build = "build.rs"
description = "Bindings for Apple's CoreAudio frameworks generated via rust-bindgen"
@ -21,8 +21,12 @@ readme = "README.md"
keywords = ["core", "audio", "unit", "osx", "ios"]
license = "MIT"
repository = "https://github.com/RustAudio/coreaudio-sys.git"
[package.metadata.docs.rs]
all-features = true
default-target = "x86_64-apple-darwin"
targets = ["x86_64-apple-darwin", "x86_64-apple-ios"]
[build-dependencies.bindgen]
version = "0.53"
version = "0.56"
features = ["runtime"]
default-features = false

2
third_party/rust/coreaudio-sys/README.md поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
# coreaudio-sys [![Build Status](https://travis-ci.org/RustAudio/coreaudio-sys.svg?branch=master)](https://travis-ci.org/RustAudio/coreaudio-sys) [![Crates.io](https://img.shields.io/crates/v/coreaudio-sys.svg)](https://crates.io/crates/coreaudio-sys) [![Crates.io](https://img.shields.io/crates/l/coreaudio-sys.svg)](https://github.com/RustAudio/coreaudio-sys/blob/master/LICENSE)
# coreaudio-sys [![Actions Status](https://github.com/rustaudio/coreaudio-sys/workflows/coreaudio-sys/badge.svg)](https://github.com/rustaudio/coreaudio-sys/actions) [![Crates.io](https://img.shields.io/crates/v/coreaudio-sys.svg)](https://crates.io/crates/coreaudio-sys) [![Crates.io](https://img.shields.io/crates/l/coreaudio-sys.svg)](https://github.com/RustAudio/coreaudio-sys/blob/master/LICENSE) [![docs.rs](https://docs.rs/coreaudio-sys/badge.svg)](https://docs.rs/coreaudio-sys/)
Raw bindings to Apple's Core Audio API for macos and iOS generated using [rust-bindgen](https://github.com/rust-lang-nursery/rust-bindgen). [coreaudio-rs](https://github.com/RustAudio/coreaudio-rs) is an attempt at offering a higher level API around this crate.

38
third_party/rust/coreaudio-sys/build.rs поставляемый
Просмотреть файл

@ -11,7 +11,12 @@ fn sdk_path(target: &str) -> Result<String, std::io::Error> {
let sdk = if target.contains("apple-darwin") {
"macosx"
} else if target.contains("apple-ios") {
} else if target == "x86_64-apple-ios" || target == "i386-apple-ios" {
"iphonesimulator"
} else if target == "aarch64-apple-ios"
|| target == "armv7-apple-ios"
|| target == "armv7s-apple-ios"
{
"iphoneos"
} else {
unreachable!();
@ -37,7 +42,7 @@ fn build(sdk_path: Option<&str>, target: &str) {
use std::env;
use std::path::PathBuf;
let mut headers = vec![];
let mut headers: Vec<&'static str> = vec![];
#[cfg(feature = "audio_toolbox")]
{
@ -47,14 +52,19 @@ fn build(sdk_path: Option<&str>, target: &str) {
#[cfg(feature = "audio_unit")]
{
println!("cargo:rustc-link-lib=framework=AudioUnit");
println!("cargo:rustc-link-lib=framework=AudioToolbox");
headers.push("AudioUnit/AudioUnit.h");
}
#[cfg(feature = "core_audio")]
{
println!("cargo:rustc-link-lib=framework=CoreAudio");
headers.push("CoreAudio/CoreAudio.h");
if target.contains("apple-ios") {
headers.push("CoreAudio/CoreAudioTypes.h");
} else {
headers.push("CoreAudio/CoreAudio.h");
}
}
#[cfg(feature = "open_al")]
@ -79,6 +89,16 @@ fn build(sdk_path: Option<&str>, target: &str) {
// Begin building the bindgen params.
let mut builder = bindgen::Builder::default();
// See https://github.com/rust-lang/rust-bindgen/issues/1211
// Technically according to the llvm mailing list, the argument to clang here should be
// -arch arm64 but it looks cleaner to just change the target.
let target = if target == "aarch64-apple-ios" {
"arm64-apple-ios"
} else if target == "aarch64-apple-darwin" {
"arm64-apple-darwin"
} else {
target
};
builder = builder.size_t_is_usize(true);
builder = builder.clang_args(&[&format!("--target={}", target)]);
@ -86,6 +106,12 @@ fn build(sdk_path: Option<&str>, target: &str) {
if let Some(sdk_path) = sdk_path {
builder = builder.clang_args(&["-isysroot", sdk_path]);
}
if target.contains("apple-ios") {
// time.h as has a variable called timezone that conflicts with some of the objective-c
// calls from NSCalendar.h in the Foundation framework. This removes that one variable.
builder = builder.blacklist_item("timezone");
builder = builder.blacklist_item("objc_object");
}
let meta_header: Vec<_> = headers
.iter()
@ -95,9 +121,7 @@ fn build(sdk_path: Option<&str>, target: &str) {
builder = builder.header_contents("coreaudio.h", &meta_header.concat());
// Generate the bindings.
builder = builder
.trust_clang_mangling(false)
.derive_default(true);
builder = builder.trust_clang_mangling(false).derive_default(true);
let bindings = builder.generate().expect("unable to generate bindings");

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"17f14e7501177f5533aef710203eb15913ebb7e709d4552265c73c6723896599","src/codec.rs":"4e2e2ef9b960ca099054c1058d3eb7716070ec1c333c91a8814433500e89d1b0","src/datagram.rs":"569f8d9e34d7ee17144bf63d34136ecd9778da0d337e513f338738c50284615e","src/event.rs":"f60fee9f4b09ef47ff5e4bfa21c07e45ffd5873c292f2605f24d834070127d62","src/incrdecoder.rs":"b97a40f89da6832ad92bd652cb6ceac82a0a5cc68a9b3d0c96f89d02e1ee9902","src/lib.rs":"5af4f0e7284b49d1b03b5eee78f2b814e5fa6eb9424507291e25b1955aebe007","src/log.rs":"b69e492af85e65866cb6588138e8a337dd897d3ce399cb4e9fb8cc04ac042b7f","src/qlog.rs":"a8aa4f1f0110076b401f6e5a7057ec154c7ad3677374a21ceca1209469b9c07d","src/timer.rs":"66886b3697e1b4232d9d9892a12d93afd3381812a8ff901bceac4bb48b264607","tests/log.rs":"480b165b7907ec642c508b303d63005eee1427115d6973a349eaf6b2242ed18d"},"package":null}
{"files":{"Cargo.toml":"6a15321a2c8dca562077929706905220370c04c4bff43848a2640fa967b0e4bc","src/codec.rs":"4e2e2ef9b960ca099054c1058d3eb7716070ec1c333c91a8814433500e89d1b0","src/datagram.rs":"569f8d9e34d7ee17144bf63d34136ecd9778da0d337e513f338738c50284615e","src/event.rs":"f60fee9f4b09ef47ff5e4bfa21c07e45ffd5873c292f2605f24d834070127d62","src/incrdecoder.rs":"b97a40f89da6832ad92bd652cb6ceac82a0a5cc68a9b3d0c96f89d02e1ee9902","src/lib.rs":"5af4f0e7284b49d1b03b5eee78f2b814e5fa6eb9424507291e25b1955aebe007","src/log.rs":"b69e492af85e65866cb6588138e8a337dd897d3ce399cb4e9fb8cc04ac042b7f","src/qlog.rs":"a8aa4f1f0110076b401f6e5a7057ec154c7ad3677374a21ceca1209469b9c07d","src/timer.rs":"66886b3697e1b4232d9d9892a12d93afd3381812a8ff901bceac4bb48b264607","tests/log.rs":"480b165b7907ec642c508b303d63005eee1427115d6973a349eaf6b2242ed18d"},"package":null}

2
third_party/rust/neqo-common/Cargo.toml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "neqo-common"
version = "0.4.16"
version = "0.4.18"
authors = ["Bobby Holley <bobbyholley@gmail.com>"]
edition = "2018"
license = "MIT/Apache-2.0"

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"399a28fb6b9832f2c437cdae37ce4e04fed3392e48f0ff9e469d937bc22ad8e0","TODO":"ac0f1c2ebcca03f5b3c0cc56c5aedbb030a4b511e438bc07a57361c789f91e9f","bindings/bindings.toml":"a896b4accf5fbaf146a45a060142974bfa2f59d6a5ab18c5080753078ae39474","bindings/mozpkix.hpp":"77072c8bb0f6eb6bfe8cbadc111dcd92e0c79936d13f2e501aae1e5d289a6675","bindings/nspr_err.h":"2d5205d017b536c2d838bcf9bc4ec79f96dd50e7bb9b73892328781f1ee6629d","bindings/nspr_error.h":"e41c03c77b8c22046f8618832c9569fbcc7b26d8b9bbc35eea7168f35e346889","bindings/nspr_io.h":"085b289849ef0e77f88512a27b4d9bdc28252bd4d39c6a17303204e46ef45f72","bindings/nspr_time.h":"2e637fd338a5cf0fd3fb0070a47f474a34c2a7f4447f31b6875f5a9928d0a261","bindings/nss_ciphers.h":"95ec6344a607558b3c5ba8510f463b6295f3a2fb3f538a01410531045a5f62d1","bindings/nss_init.h":"ef49045063782fb612aff459172cc6a89340f15005808608ade5320ca9974310","bindings/nss_p11.h":"0b81e64fe6db49b2ecff94edd850be111ef99ec11220e88ceb1c67be90143a78","bindings/nss_secerr.h":"713e8368bdae5159af7893cfa517dabfe5103cede051dee9c9557c850a2defc6","bindings/nss_ssl.h":"af222fb957b989e392e762fa2125c82608a0053aff4fb97e556691646c88c335","bindings/nss_sslerr.h":"24b97f092183d8486f774cdaef5030d0249221c78343570d83a4ee5b594210ae","bindings/nss_sslopt.h":"b7807eb7abdad14db6ad7bc51048a46b065a0ea65a4508c95a12ce90e59d1eea","build.rs":"5e7fa86d565707908611b37f9ec679d29afa33cdc4d0c589e398d4240e236f68","src/aead.rs":"e26ad34f7168f42aa87eb3a6455af3191a0e8555782b1d70032fe1d248922f98","src/agent.rs":"9dae2fa87a5a7b65dfc7fdd1b2ab1be0f75f1d9ee6704b44edd9bd406252b10a","src/agentio.rs":"cc562d09a09719b90b4e1d147fd579e3e89b683448709e920033bceaea108a61","src/auth.rs":"71ac7e297a5f872d26cf67b6bbd96e4548ea38374bdd84c1094f76a5de4ed1cb","src/cert.rs":"fd3fd2bbb38754bdcee3898549feae412943c9f719032531c1ad6e61783b5394","src/constants.rs":"c39ee506a10d685fda77c1d2ddf691b595b067b4e1044ac7a21e360119d6002b","src/err.rs":"04f38831ca62d29d8aadfe9daf95fd29e68ece184e6d3e00bfb9ee1d12744033","src/exp.rs":"61586662407359c1ecb8ed4987bc3c702f26ba2e203a091a51b6d6363cbd510f","src/ext.rs":"97cba23247e5f9656f27587214f7d7370a69174bae5960a012ce3e6fc99f9116","src/hkdf.rs":"40e44f4280497ef525c2b4c465f14f06d241150851668b264ee958f74321cfbe","src/hp.rs":"974844d885d23c480d5256621053d590b331067b43ee4061e519e58487f5852b","src/lib.rs":"3b22108a069c8c9f1b78e94d48c8759b17e0941b28e2def3fa343d6acace4b6d","src/once.rs":"b9850384899a1a016e839743d3489c0d4d916e1973746ef8c89872105d7d9736","src/p11.rs":"0b62ee5938aefb82e8faee5aa14e990a00442cc9744e8ba22eda80b32030c42c","src/prio.rs":"bc4e97049563b136cb7b39f5171e7909d56a77ed46690aaacb781eeb4a4743e0","src/replay.rs":"40924865994396441a68e6009ecbdf352d6a02fdf539aa65604124e26bffb4d3","src/result.rs":"cef34dfcb907723e195b56501132e4560e250b327783cb5e41201da5b63e9b5c","src/secrets.rs":"acb5befa74e06281c6f80d7298efc58f568bb4e6d949b4225c335e3f392be741","src/selfencrypt.rs":"429cb889a4e9e2345888cc033115c0aa306d2ff90bdfe22b3067700eb1426c37","src/ssl.rs":"3e3a4f539f3c4d18bd6e774dc34fca611db0c75bba00badcd2078c975db055bf","src/time.rs":"5b2ab4028b04b6245c666f33f1c1449816d3d1eb8141f723f5773f21f8fe4388","tests/aead.rs":"a1d8eb69f5672e064f84dce3d214b347a396718e3de56d57ccc108ee87f1cbc1","tests/agent.rs":"d43e5b05dcc845394d3c7312974faae0fdcbc325c07c970aeb7ef30c3ade652e","tests/ext.rs":"eba9f03accdd598e38292ac88263a81b367d60d5a736a43117a3663de105ec48","tests/handshake.rs":"93c478fcd07d29691007abd6dcfcd2014c10c23b0206ba2d97d01594e4d64397","tests/hkdf.rs":"539235e9dcf2a56b72961a9a04f0080409adf6bf465bfad7c30026421b2d4326","tests/hp.rs":"e52a7d2f4387f2dfe8bfe1da5867e8e0d3eb51e171c6904e18b18c4343536af8","tests/init.rs":"20aad800ac793aaf83059cf860593750509fdedeeff0c08a648e7a5cb398dae0","tests/selfencrypt.rs":"46e9a1a09c2ae577eb106d23a5cdacf762575c0dea1948aedab06ef7389ce713"},"package":null}
{"files":{"Cargo.toml":"4b26846b8798b1d68001f22f758286b5a6dce8b37fd2d330a4dab03b418fa2b7","TODO":"ac0f1c2ebcca03f5b3c0cc56c5aedbb030a4b511e438bc07a57361c789f91e9f","bindings/bindings.toml":"a896b4accf5fbaf146a45a060142974bfa2f59d6a5ab18c5080753078ae39474","bindings/mozpkix.hpp":"77072c8bb0f6eb6bfe8cbadc111dcd92e0c79936d13f2e501aae1e5d289a6675","bindings/nspr_err.h":"2d5205d017b536c2d838bcf9bc4ec79f96dd50e7bb9b73892328781f1ee6629d","bindings/nspr_error.h":"e41c03c77b8c22046f8618832c9569fbcc7b26d8b9bbc35eea7168f35e346889","bindings/nspr_io.h":"085b289849ef0e77f88512a27b4d9bdc28252bd4d39c6a17303204e46ef45f72","bindings/nspr_time.h":"2e637fd338a5cf0fd3fb0070a47f474a34c2a7f4447f31b6875f5a9928d0a261","bindings/nss_ciphers.h":"95ec6344a607558b3c5ba8510f463b6295f3a2fb3f538a01410531045a5f62d1","bindings/nss_init.h":"ef49045063782fb612aff459172cc6a89340f15005808608ade5320ca9974310","bindings/nss_p11.h":"0b81e64fe6db49b2ecff94edd850be111ef99ec11220e88ceb1c67be90143a78","bindings/nss_secerr.h":"713e8368bdae5159af7893cfa517dabfe5103cede051dee9c9557c850a2defc6","bindings/nss_ssl.h":"af222fb957b989e392e762fa2125c82608a0053aff4fb97e556691646c88c335","bindings/nss_sslerr.h":"24b97f092183d8486f774cdaef5030d0249221c78343570d83a4ee5b594210ae","bindings/nss_sslopt.h":"b7807eb7abdad14db6ad7bc51048a46b065a0ea65a4508c95a12ce90e59d1eea","build.rs":"5e7fa86d565707908611b37f9ec679d29afa33cdc4d0c589e398d4240e236f68","src/aead.rs":"e26ad34f7168f42aa87eb3a6455af3191a0e8555782b1d70032fe1d248922f98","src/agent.rs":"9dae2fa87a5a7b65dfc7fdd1b2ab1be0f75f1d9ee6704b44edd9bd406252b10a","src/agentio.rs":"cc562d09a09719b90b4e1d147fd579e3e89b683448709e920033bceaea108a61","src/auth.rs":"71ac7e297a5f872d26cf67b6bbd96e4548ea38374bdd84c1094f76a5de4ed1cb","src/cert.rs":"fd3fd2bbb38754bdcee3898549feae412943c9f719032531c1ad6e61783b5394","src/constants.rs":"c39ee506a10d685fda77c1d2ddf691b595b067b4e1044ac7a21e360119d6002b","src/err.rs":"04f38831ca62d29d8aadfe9daf95fd29e68ece184e6d3e00bfb9ee1d12744033","src/exp.rs":"61586662407359c1ecb8ed4987bc3c702f26ba2e203a091a51b6d6363cbd510f","src/ext.rs":"97cba23247e5f9656f27587214f7d7370a69174bae5960a012ce3e6fc99f9116","src/hkdf.rs":"40e44f4280497ef525c2b4c465f14f06d241150851668b264ee958f74321cfbe","src/hp.rs":"974844d885d23c480d5256621053d590b331067b43ee4061e519e58487f5852b","src/lib.rs":"3b22108a069c8c9f1b78e94d48c8759b17e0941b28e2def3fa343d6acace4b6d","src/once.rs":"b9850384899a1a016e839743d3489c0d4d916e1973746ef8c89872105d7d9736","src/p11.rs":"0b62ee5938aefb82e8faee5aa14e990a00442cc9744e8ba22eda80b32030c42c","src/prio.rs":"bc4e97049563b136cb7b39f5171e7909d56a77ed46690aaacb781eeb4a4743e0","src/replay.rs":"40924865994396441a68e6009ecbdf352d6a02fdf539aa65604124e26bffb4d3","src/result.rs":"cef34dfcb907723e195b56501132e4560e250b327783cb5e41201da5b63e9b5c","src/secrets.rs":"acb5befa74e06281c6f80d7298efc58f568bb4e6d949b4225c335e3f392be741","src/selfencrypt.rs":"429cb889a4e9e2345888cc033115c0aa306d2ff90bdfe22b3067700eb1426c37","src/ssl.rs":"3e3a4f539f3c4d18bd6e774dc34fca611db0c75bba00badcd2078c975db055bf","src/time.rs":"5b2ab4028b04b6245c666f33f1c1449816d3d1eb8141f723f5773f21f8fe4388","tests/aead.rs":"a1d8eb69f5672e064f84dce3d214b347a396718e3de56d57ccc108ee87f1cbc1","tests/agent.rs":"d43e5b05dcc845394d3c7312974faae0fdcbc325c07c970aeb7ef30c3ade652e","tests/ext.rs":"eba9f03accdd598e38292ac88263a81b367d60d5a736a43117a3663de105ec48","tests/handshake.rs":"93c478fcd07d29691007abd6dcfcd2014c10c23b0206ba2d97d01594e4d64397","tests/hkdf.rs":"539235e9dcf2a56b72961a9a04f0080409adf6bf465bfad7c30026421b2d4326","tests/hp.rs":"e52a7d2f4387f2dfe8bfe1da5867e8e0d3eb51e171c6904e18b18c4343536af8","tests/init.rs":"20aad800ac793aaf83059cf860593750509fdedeeff0c08a648e7a5cb398dae0","tests/selfencrypt.rs":"46e9a1a09c2ae577eb106d23a5cdacf762575c0dea1948aedab06ef7389ce713"},"package":null}

4
third_party/rust/neqo-crypto/Cargo.toml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "neqo-crypto"
version = "0.4.16"
version = "0.4.18"
authors = ["Martin Thomson <mt@lowentropy.net>"]
edition = "2018"
build = "build.rs"
@ -11,7 +11,7 @@ neqo-common = { path = "../neqo-common" }
log = {version = "0.4.0", default-features = false}
[build-dependencies]
bindgen = {version = "0.53.2", default-features = false, features= ["runtime"]}
bindgen = {version = "0.56", default-features = false, features= ["runtime"]}
serde = "1.0"
serde_derive = "1.0"
toml = "0.4"

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"1a9556a8bd2c22ca1d8bb6312c59a60dcdf18dee50b2e3ec878f5363f956f4ec","src/client_events.rs":"87e7c323ec2ceb759da7d6f2bf24e774f6f2e3833f63454d09cc09f47fccfa8e","src/connection.rs":"a5edd447cc1005e2024690488ae700bd4ed8f3b76d1efc25560c99ff17b2bb06","src/connection_client.rs":"2882115aa375cc6182fe427d6792846222912f1a499db6ddd25dc7ec1d224d14","src/connection_server.rs":"b3f4d42a984f7093fca737c64bb49c569f8f95d1586a6c02d4dba58f290ce92e","src/control_stream_local.rs":"2e9483d79dc00a3e5ef51ea2b0f28fda2b67348996c47729947c70a8be3007ed","src/control_stream_remote.rs":"1dfac4956a7d6971e2cef2c83963d838e73aa3bf3286b7bde97099978c41d527","src/hframe.rs":"3620c6d114e6d5b98447a2dd2a7cb6872562ebda2cc6de828177b745c8dcbf4d","src/lib.rs":"faddc55396ced80d9808bdac98d4db4548651fe60b567b152067e0387825b94c","src/push_controller.rs":"3a44843f3d56246198bcc7378914941a337ddac2c2d4c389e8d0628448452aa7","src/push_stream.rs":"5f3a5c6d72c0a8e4d1c1c5041125f7aff9a65950fa60c77f42cd4b35c768f585","src/qlog.rs":"29c0e3c4c9571eb7fe905967edeb1c4bc236b1e35a0e0f11a4a847f1d246681d","src/recv_message.rs":"566c99bfd9abd948738ad26c3ec08ddd37c8caf7577fcf2ced3ccca5bcefac69","src/send_message.rs":"7e3f5280eca9b007b3b189134ce6832d3996f10405d396790acbced06a72af81","src/server.rs":"f369e5cae36598bb0bfa06aa5da310a55ce3c785bcb16cfb27acf4b5e98d068b","src/server_connection_events.rs":"762ddb87f700abe91ae1ae78ebbb87a88da0c0a341748b0751b01099870e9985","src/server_events.rs":"e780daa0d19d9a5594eee73f7ff27d56151a5a2ea969f2b4dcc64253e9570dab","src/settings.rs":"127a51fa7857b870718baa14340b0461d86a67e59bf1a8cb42d7bae0240c0ef1","src/stream_type_reader.rs":"aacb2e865f79b3ac55a887fd670f2286d8ffef94f7d8b3ecfa7e0cccbfa9ec04","tests/httpconn.rs":"1a97a80f7abe11c6ba0bd9b41003be6b293049164daa21e907365d93b00a782f"},"package":null}
{"files":{"Cargo.toml":"72f4c424d368ab7875d81c512518e71a5da7ff9778f124de3abd59f531a74f35","src/client_events.rs":"87e7c323ec2ceb759da7d6f2bf24e774f6f2e3833f63454d09cc09f47fccfa8e","src/connection.rs":"a5edd447cc1005e2024690488ae700bd4ed8f3b76d1efc25560c99ff17b2bb06","src/connection_client.rs":"2882115aa375cc6182fe427d6792846222912f1a499db6ddd25dc7ec1d224d14","src/connection_server.rs":"b3f4d42a984f7093fca737c64bb49c569f8f95d1586a6c02d4dba58f290ce92e","src/control_stream_local.rs":"2e9483d79dc00a3e5ef51ea2b0f28fda2b67348996c47729947c70a8be3007ed","src/control_stream_remote.rs":"1dfac4956a7d6971e2cef2c83963d838e73aa3bf3286b7bde97099978c41d527","src/hframe.rs":"3620c6d114e6d5b98447a2dd2a7cb6872562ebda2cc6de828177b745c8dcbf4d","src/lib.rs":"faddc55396ced80d9808bdac98d4db4548651fe60b567b152067e0387825b94c","src/push_controller.rs":"3a44843f3d56246198bcc7378914941a337ddac2c2d4c389e8d0628448452aa7","src/push_stream.rs":"5f3a5c6d72c0a8e4d1c1c5041125f7aff9a65950fa60c77f42cd4b35c768f585","src/qlog.rs":"29c0e3c4c9571eb7fe905967edeb1c4bc236b1e35a0e0f11a4a847f1d246681d","src/recv_message.rs":"566c99bfd9abd948738ad26c3ec08ddd37c8caf7577fcf2ced3ccca5bcefac69","src/send_message.rs":"7e3f5280eca9b007b3b189134ce6832d3996f10405d396790acbced06a72af81","src/server.rs":"f369e5cae36598bb0bfa06aa5da310a55ce3c785bcb16cfb27acf4b5e98d068b","src/server_connection_events.rs":"762ddb87f700abe91ae1ae78ebbb87a88da0c0a341748b0751b01099870e9985","src/server_events.rs":"e780daa0d19d9a5594eee73f7ff27d56151a5a2ea969f2b4dcc64253e9570dab","src/settings.rs":"127a51fa7857b870718baa14340b0461d86a67e59bf1a8cb42d7bae0240c0ef1","src/stream_type_reader.rs":"aacb2e865f79b3ac55a887fd670f2286d8ffef94f7d8b3ecfa7e0cccbfa9ec04","tests/httpconn.rs":"1a97a80f7abe11c6ba0bd9b41003be6b293049164daa21e907365d93b00a782f"},"package":null}

2
third_party/rust/neqo-http3/Cargo.toml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "neqo-http3"
version = "0.4.16"
version = "0.4.18"
authors = ["Dragana Damjanovic <dragana.damjano@gmail.com>"]
edition = "2018"
license = "MIT/Apache-2.0"

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"2629bfcfe7d51690ba7cac0db84944bbf6adf51e0de62b8a165472d512d88be7","src/decoder.rs":"31fc99c0772d241949eddd4572a8b1911525bd9caecf27f9073e6dc381df41b7","src/decoder_instructions.rs":"a8e04dff5fc4c658322a10daadab947dc2e41932c00c3f8d387671a86d0516af","src/encoder.rs":"396f004d3aa2ce221392fd521f77d7ec8967b0fb405b8ffd7bfcc31f30cb0e60","src/encoder_instructions.rs":"1d4424bf21c0ac26b7c8fee6450b943346c5493ab86dd7ec2edc5f566454721e","src/header_block.rs":"f935872919154f678947732270d688be4790309f9e390a0c8eb6c9484a41a8dd","src/huffman.rs":"68fa0bada0c35d20f793980596accdcc548970214841f71789290fc334e51fc1","src/huffman_decode_helper.rs":"2970c57f052878b727c2f764490c54184f5c2608e1d6aa961c3b01509e290122","src/huffman_table.rs":"06fea766a6276ac56c7ee0326faed800a742c15fda1f33bf2513e6cc6a5e6d27","src/lib.rs":"88fba397ddf2a8f0d6b55b9a8852c715fe884e7e2808729f69df11dcc03b0356","src/prefix.rs":"72c587c40aef4ed38cf13b2de91091d671611679be2a9da6f0b24abafaf50dc5","src/qlog.rs":"7618085e27bb3fb1f4d1c73ba501b9a293723293c4020b7cc4129676eb278131","src/qpack_send_buf.rs":"5170b93afaf0c1609463e6c5ae4dccb1a2ce4e4407296db1bcaf06c6b5bb97ab","src/reader.rs":"4bcea0de1d7dc09ec0cdff364d8f62da54bbbe1f6db55a495f943f31369b4074","src/static_table.rs":"fda9d5c6f38f94b0bf92d3afdf8432dce6e27e189736596e16727090c77b78ec","src/stats.rs":"624dfa3b40858c304097bb0ce5b1be1bb4d7916b1abfc222f1aa705907009730","src/table.rs":"f7091bdd9ad1f8fe3b2298a7dbfd3d285c212d69569cda54f9bcf251cb758a21"},"package":null}
{"files":{"Cargo.toml":"382081ea6bff8fca6d751da5d50dae3f9a86341626f56ba2203eade35fd2cb6a","src/decoder.rs":"31fc99c0772d241949eddd4572a8b1911525bd9caecf27f9073e6dc381df41b7","src/decoder_instructions.rs":"a8e04dff5fc4c658322a10daadab947dc2e41932c00c3f8d387671a86d0516af","src/encoder.rs":"1de5c71277a565371e3ae3fc55c932eb3d70d03225a100642c7df4e193281589","src/encoder_instructions.rs":"1d4424bf21c0ac26b7c8fee6450b943346c5493ab86dd7ec2edc5f566454721e","src/header_block.rs":"f935872919154f678947732270d688be4790309f9e390a0c8eb6c9484a41a8dd","src/huffman.rs":"68fa0bada0c35d20f793980596accdcc548970214841f71789290fc334e51fc1","src/huffman_decode_helper.rs":"2970c57f052878b727c2f764490c54184f5c2608e1d6aa961c3b01509e290122","src/huffman_table.rs":"06fea766a6276ac56c7ee0326faed800a742c15fda1f33bf2513e6cc6a5e6d27","src/lib.rs":"88fba397ddf2a8f0d6b55b9a8852c715fe884e7e2808729f69df11dcc03b0356","src/prefix.rs":"72c587c40aef4ed38cf13b2de91091d671611679be2a9da6f0b24abafaf50dc5","src/qlog.rs":"7618085e27bb3fb1f4d1c73ba501b9a293723293c4020b7cc4129676eb278131","src/qpack_send_buf.rs":"5170b93afaf0c1609463e6c5ae4dccb1a2ce4e4407296db1bcaf06c6b5bb97ab","src/reader.rs":"4bcea0de1d7dc09ec0cdff364d8f62da54bbbe1f6db55a495f943f31369b4074","src/static_table.rs":"fda9d5c6f38f94b0bf92d3afdf8432dce6e27e189736596e16727090c77b78ec","src/stats.rs":"624dfa3b40858c304097bb0ce5b1be1bb4d7916b1abfc222f1aa705907009730","src/table.rs":"f7091bdd9ad1f8fe3b2298a7dbfd3d285c212d69569cda54f9bcf251cb758a21"},"package":null}

2
third_party/rust/neqo-qpack/Cargo.toml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "neqo-qpack"
version = "0.4.16"
version = "0.4.18"
authors = ["Dragana Damjanovic <dragana.damjano@gmail.com>"]
edition = "2018"
license = "MIT/Apache-2.0"

164
third_party/rust/neqo-qpack/src/encoder.rs поставляемый
Просмотреть файл

@ -191,7 +191,7 @@ impl QPackEncoder {
fn stream_cancellation(&mut self, stream_id: u64) -> Res<()> {
self.stats.stream_cancelled_recv += 1;
let mut was_blocker = false;
if let Some(hb_list) = self.unacked_header_blocks.get_mut(&stream_id) {
if let Some(mut hb_list) = self.unacked_header_blocks.remove(&stream_id) {
debug_assert!(!hb_list.is_empty());
while let Some(ref_list) = hb_list.pop_front() {
for iter in ref_list {
@ -546,6 +546,41 @@ mod tests {
// We will try to really change the table only when we send the change capacity instruction.
self.encoder.send(&mut self.conn)
}
pub fn insert(&mut self, header: &[u8], value: &[u8], inst: &[u8]) {
let res = self.encoder.send_and_insert(&mut self.conn, header, value);
assert!(res.is_ok());
self.send_instructions(inst);
}
pub fn encode_header_block(
&mut self,
stream_id: u64,
headers: &[Header],
expected_encoding: &[u8],
inst: &[u8],
) {
let buf = self
.encoder
.encode_header_block(&mut self.conn, headers, stream_id)
.unwrap();
assert_eq!(&buf[..], expected_encoding);
self.send_instructions(inst);
}
pub fn send_instructions(&mut self, encoder_instruction: &[u8]) {
self.encoder.send(&mut self.conn).unwrap();
let out = self.conn.process(None, now());
let out2 = self.peer_conn.process(out.dgram(), now());
let _ = self.conn.process(out2.dgram(), now());
let mut buf = [0_u8; 100];
let (amount, fin) = self
.peer_conn
.stream_recv(self.send_stream_id, &mut buf)
.unwrap();
assert_eq!(fin, false);
assert_eq!(buf[..amount], encoder_instruction[..]);
}
}
fn connect_generic<F>(huffman: bool, f: F) -> TestEncoder
@ -599,20 +634,6 @@ mod tests {
})
}
fn send_instructions(encoder: &mut TestEncoder, encoder_instruction: &[u8]) {
encoder.encoder.send(&mut encoder.conn).unwrap();
let out = encoder.conn.process(None, now());
let out2 = encoder.peer_conn.process(out.dgram(), now());
let _ = encoder.conn.process(out2.dgram(), now());
let mut buf = [0_u8; 100];
let (amount, fin) = encoder
.peer_conn
.stream_recv(encoder.send_stream_id, &mut buf)
.unwrap();
assert_eq!(fin, false);
assert_eq!(buf[..amount], encoder_instruction[..]);
}
fn recv_instruction(encoder: &mut TestEncoder, decoder_instruction: &[u8]) {
encoder
.peer_conn
@ -667,7 +688,7 @@ mod tests {
.encoder
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert_eq!(Error::DynamicTableFull, res.unwrap_err());
send_instructions(&mut encoder, &[0x02]);
encoder.send_instructions(&[0x02]);
}
// test insert_with_name_literal - succeeds
@ -677,7 +698,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(200).is_ok());
// test the change capacity instruction.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
// insert "content-length: 1234
let res =
@ -685,7 +706,7 @@ mod tests {
.encoder
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
}
#[test]
@ -693,7 +714,7 @@ mod tests {
let mut encoder = connect(false);
assert!(encoder.encoder.set_max_capacity(200).is_ok());
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
}
struct TestElement {
@ -766,7 +787,7 @@ mod tests {
encoder.encoder.set_max_capacity(200).unwrap();
// test the change capacity instruction.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
for t in &test_cases {
let buf = encoder
@ -774,7 +795,7 @@ mod tests {
.encode_header_block(&mut encoder.conn, &t.headers, 1)
.unwrap();
assert_eq!(&buf[..], t.header_block);
send_instructions(&mut encoder, t.encoder_inst);
encoder.send_instructions(t.encoder_inst);
}
}
@ -840,7 +861,7 @@ mod tests {
encoder.encoder.set_max_capacity(200).unwrap();
// test the change capacity instruction.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
for t in &test_cases {
let buf = encoder
@ -848,7 +869,7 @@ mod tests {
.encode_header_block(&mut encoder.conn, &t.headers, 1)
.unwrap();
assert_eq!(&buf[..], t.header_block);
send_instructions(&mut encoder, t.encoder_inst);
encoder.send_instructions(t.encoder_inst);
}
}
@ -860,7 +881,7 @@ mod tests {
encoder.encoder.set_max_capacity(60).unwrap();
// test the change capacity instruction.
send_instructions(&mut encoder, CAP_INSTRUCTION_60);
encoder.send_instructions(CAP_INSTRUCTION_60);
// insert "content-length: 1234
let res =
@ -868,7 +889,7 @@ mod tests {
.encoder
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
// insert "content-length: 12345 which will fail because the ntry in the table cannot be evicted.
let res =
@ -876,7 +897,7 @@ mod tests {
.encoder
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_2);
assert!(res.is_err());
send_instructions(&mut encoder, &[]);
encoder.send_instructions(&[]);
// receive an insert count increment.
recv_instruction(&mut encoder, &[0x01]);
@ -887,7 +908,7 @@ mod tests {
.encoder
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_2);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_2_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_2_NAME_LITERAL);
}
// Test inserts block on waiting for acks
@ -899,7 +920,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(60).is_ok());
// test the change capacity instruction.
send_instructions(&mut encoder, CAP_INSTRUCTION_60);
encoder.send_instructions(CAP_INSTRUCTION_60);
// insert "content-length: 1234
let res =
@ -907,7 +928,7 @@ mod tests {
.encoder
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
// receive an insert count increment.
recv_instruction(&mut encoder, &[0x01]);
@ -922,7 +943,7 @@ mod tests {
)
.unwrap();
assert_eq!(&buf[..], ENCODE_INDEXED_REF_DYNAMIC);
send_instructions(&mut encoder, &[]);
encoder.send_instructions(&[]);
// insert "content-length: 12345 which will fail because the entry in the table cannot be evicted
let res =
@ -930,7 +951,7 @@ mod tests {
.encoder
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_2);
assert!(res.is_err());
send_instructions(&mut encoder, &[]);
encoder.send_instructions(&[]);
if wait == 0 {
// receive a header_ack.
@ -946,7 +967,7 @@ mod tests {
.encoder
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_2);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_2_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_2_NAME_LITERAL);
}
#[test]
@ -982,7 +1003,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(60).is_ok());
// change capacity to 60.
send_instructions(&mut encoder, CAP_INSTRUCTION_60);
encoder.send_instructions(CAP_INSTRUCTION_60);
// insert "content-length: 1234
let res =
@ -991,7 +1012,7 @@ mod tests {
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
encoder.encoder.set_max_blocked_streams(1).unwrap();
@ -1008,7 +1029,7 @@ mod tests {
assert_eq!(encoder.encoder.blocked_stream_cnt(), 1);
send_instructions(&mut encoder, &[]);
encoder.send_instructions(&[]);
// The next one will not use the dynamic entry because it is exceeding the max_blocked_streams
// limit.
@ -1022,7 +1043,7 @@ mod tests {
.unwrap();
assert_is_index_to_static_name_only(&buf);
send_instructions(&mut encoder, &[]);
encoder.send_instructions(&[]);
assert_eq!(encoder.encoder.blocked_stream_cnt(), 1);
// another header block to already blocked stream can still use the entry.
@ -1046,7 +1067,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(200).is_ok());
// change capacity to 200.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
// insert "content-length: 1234
let res =
@ -1055,7 +1076,7 @@ mod tests {
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
// insert "content-length: 12345
let res =
@ -1064,7 +1085,7 @@ mod tests {
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_2);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_2_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_2_NAME_LITERAL);
encoder.encoder.set_max_blocked_streams(1).unwrap();
@ -1102,7 +1123,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(200).is_ok());
// change capacity to 200.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
encoder.encoder.set_max_blocked_streams(1).unwrap();
@ -1155,7 +1176,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(200).is_ok());
// change capacity to 200.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
encoder.encoder.set_max_blocked_streams(1).unwrap();
@ -1201,7 +1222,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(200).is_ok());
// change capacity to 200.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
encoder.encoder.set_max_blocked_streams(1).unwrap();
@ -1247,7 +1268,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(200).is_ok());
// change capacity to 200.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
encoder.encoder.set_max_blocked_streams(2).unwrap();
@ -1293,7 +1314,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(200).is_ok());
// change capacity to 200.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
encoder.encoder.set_max_blocked_streams(2).unwrap();
@ -1341,7 +1362,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(200).is_ok());
// change capacity to 200.
send_instructions(&mut encoder, CAP_INSTRUCTION_200);
encoder.send_instructions(CAP_INSTRUCTION_200);
encoder.encoder.set_max_blocked_streams(2).unwrap();
@ -1401,7 +1422,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(60).is_ok());
// change capacity to 60.
send_instructions(&mut encoder, CAP_INSTRUCTION_60);
encoder.send_instructions(CAP_INSTRUCTION_60);
encoder.encoder.set_max_blocked_streams(2).unwrap();
@ -1412,7 +1433,7 @@ mod tests {
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
// send a header block, it refers to unacked entry.
let buf = encoder
@ -1448,7 +1469,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(60).is_ok());
// change capacity to 60.
send_instructions(&mut encoder, CAP_INSTRUCTION_60);
encoder.send_instructions(CAP_INSTRUCTION_60);
encoder.encoder.set_max_blocked_streams(2).unwrap();
@ -1459,7 +1480,7 @@ mod tests {
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
// send a header block, it refers to unacked entry.
let buf = encoder
@ -1495,7 +1516,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(60).is_ok());
// change capacity to 60.
send_instructions(&mut encoder, CAP_INSTRUCTION_60);
encoder.send_instructions(CAP_INSTRUCTION_60);
encoder.encoder.set_max_blocked_streams(2).unwrap();
@ -1506,7 +1527,7 @@ mod tests {
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
// trying to evict the entry will failed, because the entry is not acked.
assert!(encoder.change_capacity(10).is_err());
@ -1525,7 +1546,7 @@ mod tests {
assert!(encoder.encoder.set_max_capacity(60).is_ok());
// change capacity to 60.
send_instructions(&mut encoder, CAP_INSTRUCTION_60);
encoder.send_instructions(CAP_INSTRUCTION_60);
encoder.encoder.set_max_blocked_streams(2).unwrap();
@ -1536,7 +1557,7 @@ mod tests {
.send_and_insert(&mut encoder.conn, HEADER_CONTENT_LENGTH, VALUE_1);
assert!(res.is_ok());
send_instructions(&mut encoder, HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
encoder.send_instructions(HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL);
// send a header block, it refers to unacked entry.
let buf = encoder
@ -1578,7 +1599,7 @@ mod tests {
// change capacity to 1000 and max_block streams to 20.
encoder.encoder.set_max_blocked_streams(20).unwrap();
assert!(encoder.encoder.set_max_capacity(1000).is_ok());
send_instructions(&mut encoder, CAP_INSTRUCTION_1000);
encoder.send_instructions(CAP_INSTRUCTION_1000);
// Write some data to fill the flow control allowance.
let stream_id = encoder.conn.stream_create(StreamType::UniDi).unwrap();
@ -1622,7 +1643,7 @@ mod tests {
assert_eq!(buf2[2] & 0xf0, 0x20);
// Ensure that we have sent only one instruction for (String::from("something"), String::from("1234"))
send_instructions(&mut encoder, ONE_INSTRUCTION);
encoder.send_instructions(ONE_INSTRUCTION);
// Try writing a new header block. Now, headers will be added to the dynamic table again, because
// instructions can be sent.
@ -1642,7 +1663,7 @@ mod tests {
assert_eq!(buf3[3], 0x11);
// Asset that 2 instruction has been sent
send_instructions(&mut encoder, TWO_INSTRUCTION);
encoder.send_instructions(TWO_INSTRUCTION);
}
#[test]
@ -1651,7 +1672,7 @@ mod tests {
// change capacity to 2000.
assert!(encoder.encoder.set_max_capacity(2000).is_ok());
send_instructions(&mut encoder, CAP_INSTRUCTION_1500);
encoder.send_instructions(CAP_INSTRUCTION_1500);
}
#[test]
@ -1684,4 +1705,33 @@ mod tests {
)
.is_ok());
}
#[test]
fn test_streams_cancel_cleans_up_unacked_header_blocks() {
let mut encoder = connect(false);
encoder.encoder.set_max_blocked_streams(10).unwrap();
assert!(encoder.change_capacity(60).is_ok());
encoder.send_instructions(CAP_INSTRUCTION_60);
// insert "content-length: 1234
encoder.insert(
HEADER_CONTENT_LENGTH,
VALUE_1,
HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL,
);
// send a header block
encoder.encode_header_block(
1,
&[(String::from("content-length"), String::from("1234"))],
ENCODE_INDEXED_REF_DYNAMIC,
&[],
);
// receive a stream canceled instruction.
recv_instruction(&mut encoder, STREAM_CANCELED_ID_1);
recv_instruction(&mut encoder, &[0x01]);
}
}

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"6ddd785466d6e5d5076c6ea258565257f373eb20d4aa2d98d9ee23a67e3d2fa5","TODO":"d759cb804b32fa9d96ea8d3574a3c4073da9fe6a0b02b708a0e22cce5a5b4a0f","src/addr_valid.rs":"1b3bef8edf87d29dc630bda7a8fdb6287093612cd8da4756f1a0e2473bb01b0f","src/cc/classic_cc.rs":"d0c55a2645d9b0ec59d8227f4340e26e8922376d68402fabcacbd13fd6b10293","src/cc/mod.rs":"36e9018f70507a80404764e646467f769f9ad0d87d5ff806450ae242dcfd18a5","src/cc/new_reno.rs":"4734a85122dae88a087952ce1f9ef006aea8405a2bc1d4a0565c5bfd238e4ef4","src/cid.rs":"e231286df599b9ee7cbae8cab274908e0197baf2b2e88bea9d8f40dbeb02c57d","src/connection/idle.rs":"e3c902858737de89e2e8955796c6e60dcfbcffaf58b3a1c4473fed04c7eae55c","src/connection/mod.rs":"2514c70e05e66c3dc5ca7c3f07feed29332f23cc1a78327bc06fafabdde28103","src/connection/saved.rs":"b70f81635e210102208790ef308a0dea4b7e87900e6083ca6b299d4c1d5b9058","src/connection/state.rs":"52b8def3097cb949888796cb07cea5cf0bb3e045fc2b22a4ca7b181e87db3640","src/connection/tests/cc.rs":"57c47c8ef7a13df2dee330951d79746fe7e995e39fc9c2d009b99f800cb8ff31","src/connection/tests/close.rs":"ddab204ae0c88bac55aed02c5eff3c793a53113dd07b489bdb7a07867df4aeac","src/connection/tests/handshake.rs":"0b1025a5e21ade6382e9b9ae5a8bf13fcd5f62b80874fa6defc54327bca2a575","src/connection/tests/idle.rs":"7c73be2a1079d2ee66960d403076b059356736b35bba657f278348493068a6a5","src/connection/tests/keys.rs":"029e0cb2a043828059f006d0e17eb36b7d978c48d16340a80711e144a709245e","src/connection/tests/mod.rs":"5ee29828f06cc92cca582206fdf5ad2254d74a93b3467222b3f3d846edb33158","src/connection/tests/recovery.rs":"f6dbdeeaec18510c0f9345ee25947c0ed988b14fddf30e124dfe6d1b9a160a71","src/connection/tests/resumption.rs":"538c0ecb7eed22ea9c22882e934bf91cc87c064c6d4286e5cc7fbbaecbc650fc","src/connection/tests/stream.rs":"37e91c34851e85763684afceca9a8498101602d629e161d99e10248f3b908a81","src/connection/tests/vn.rs":"ffb1c34be57b2cae704b387a2599cedeb1a8775d5a5e48eb0d0113d767c4e6a6","src/connection/tests/zerortt.rs":"8c5e874b36e34306f640ba7fc760d38847292b399f6eec97b565de12b77cbd76","src/crypto.rs":"ed07cd03f9bcbbcba770f42062e72b2957bf1fb098c77d23e7a03c4ddc6fe213","src/dump.rs":"d69ccb0e3b240823b886a791186afbac9f2e26d1f1f67a55dbf86f8cd3e6203e","src/events.rs":"6d1e168eb8c425018281e82ba3ff05ea0321035eb677f1d1bdd19fe32c1e62ce","src/flow_mgr.rs":"4f667a5b8574c248e7422aaac3492d89f4a2e7e202a19083b9f84cf129e49037","src/frame.rs":"d2d175fb058c4157c8717595784c2ab26df8ae9b5e2ba2e99d579203314991c0","src/lib.rs":"580c2065f035c5759d3ee9f735ade6dbf86a5351000a4e86f61fa40001e00c27","src/pace.rs":"eb9094cfcae54162022f70f230b6a9811add0063b878100f147a9365473f6612","src/packet/mod.rs":"928e67a595bcbc2512c45374e6b84332832e87a1e4309f72d3f7604c24a76817","src/packet/retry.rs":"670b2d3363121a7a98fb6efe186c3818786093502b53b7d9d104368de3376555","src/path.rs":"92b2701d1e486250f472b2cdc487b1e9e9c8753c9c40b626c2d6d1ccd6e70c38","src/qlog.rs":"b2853fdc7acfb86c8b802a39f32b0462dd82bf86f5c427ffdb523be933268532","src/recovery.rs":"c65092d01e75d640bfb465c36ce9b6285e080da1608a4fe0c83ace64c639254a","src/recv_stream.rs":"71143d3ce2670d55dbc5cf7ecd9d3b5826a3060029162f335fffd197bedf149f","src/send_stream.rs":"4c019d99cdb1ad76bc5434fbde009371a49ef61138e84609595686af8e2ca651","src/sender.rs":"fdb16a6c44473dbd2dce3f0982f467e4cc8af579b9bd2abf2f3444845d2c07d0","src/server.rs":"cdb0eb1e194110a39335e75018b861e34fab855adf76fb218c7b982bd10f7833","src/stats.rs":"4a3b5560dbb6a32414b80cc82c062c9a64e5f7aba75416f0208a2477f355e6f0","src/stream_id.rs":"98f656157e0eeb7f32802cf2b3dbd68ef8d7a89578a097a88db7157d4a712202","src/tparams.rs":"d4a69bff044f51acab5dcbe56531bfd5eee79b99908c79074409d38ead8d3467","src/tracking.rs":"7dfe2f6702609361348eeddfc0ea61b9a58c31d88884adfe5c550d94cdbc2268","tests/conn_vectors.rs":"d5bd7ba17dfd3f7c6fe421ebd346ba7df8ddc08756fa7a747ecba52bcca6a7f0","tests/connection.rs":"fe9b7069b34fea7f5154e9b1ea3bffb290a4aa9a7c97c30992c51fa7a6ad6673","tests/network.rs":"a986c22da7132ec843a44c4bcb5a7d2726132aa27a47a8ea91634cd88e1b763b","tests/server.rs":"9eda88cbf7840b829ae62dcbe2eec381b42a3a00c915cfb371047c60d4677664","tests/sim/connection.rs":"5e65e7247f69ad9d992cffc9daac6a8af360c6c312e6588da07478337a12819f","tests/sim/delay.rs":"9efa722adb89e37262369e9f3c67405f0acc8c24997271811e48df9e856e5a8d","tests/sim/drop.rs":"bd89e5c71cdd1b27cd755faaedd87d5feadf2f424df721a7df41a51bcebcbb58","tests/sim/mod.rs":"9a930682cf92e7279bccdd2145f19ff17f5aa950994e7b3e25749651511c2753","tests/sim/net.rs":"597f4d37bc26c3d82eeeaa6d14dd03bc2be3930686df2b293748b43c07c497d7","tests/sim/rng.rs":"2c90b0bbaf0c952ebee232deb3594f7a86af387737b15474de3e97ee6b623d90","tests/sim/taildrop.rs":"5c505d150f0071e8cc2d540b3a817a6942fdf13df32f1fbc6822952f2e146176"},"package":null}
{"files":{"Cargo.toml":"707af9ed225c7d2f570bec3de79f909918bd6243d62c317bcfd8babaf4366da7","TODO":"d759cb804b32fa9d96ea8d3574a3c4073da9fe6a0b02b708a0e22cce5a5b4a0f","src/addr_valid.rs":"1b3bef8edf87d29dc630bda7a8fdb6287093612cd8da4756f1a0e2473bb01b0f","src/cc/classic_cc.rs":"d0c55a2645d9b0ec59d8227f4340e26e8922376d68402fabcacbd13fd6b10293","src/cc/mod.rs":"36e9018f70507a80404764e646467f769f9ad0d87d5ff806450ae242dcfd18a5","src/cc/new_reno.rs":"4734a85122dae88a087952ce1f9ef006aea8405a2bc1d4a0565c5bfd238e4ef4","src/cid.rs":"e231286df599b9ee7cbae8cab274908e0197baf2b2e88bea9d8f40dbeb02c57d","src/connection/idle.rs":"e3c902858737de89e2e8955796c6e60dcfbcffaf58b3a1c4473fed04c7eae55c","src/connection/mod.rs":"65e7faf004f991097949a8e9e3e677d4060ea53042d786ddf4b714b9637f8d4e","src/connection/saved.rs":"b70f81635e210102208790ef308a0dea4b7e87900e6083ca6b299d4c1d5b9058","src/connection/state.rs":"52b8def3097cb949888796cb07cea5cf0bb3e045fc2b22a4ca7b181e87db3640","src/connection/tests/cc.rs":"57c47c8ef7a13df2dee330951d79746fe7e995e39fc9c2d009b99f800cb8ff31","src/connection/tests/close.rs":"cd2fbaf378afcf7bad5046bd11bdcd1fc66a2a8108401e0a3dd2031df1f95091","src/connection/tests/handshake.rs":"0b1025a5e21ade6382e9b9ae5a8bf13fcd5f62b80874fa6defc54327bca2a575","src/connection/tests/idle.rs":"7c73be2a1079d2ee66960d403076b059356736b35bba657f278348493068a6a5","src/connection/tests/keys.rs":"029e0cb2a043828059f006d0e17eb36b7d978c48d16340a80711e144a709245e","src/connection/tests/mod.rs":"5ee29828f06cc92cca582206fdf5ad2254d74a93b3467222b3f3d846edb33158","src/connection/tests/recovery.rs":"f6dbdeeaec18510c0f9345ee25947c0ed988b14fddf30e124dfe6d1b9a160a71","src/connection/tests/resumption.rs":"538c0ecb7eed22ea9c22882e934bf91cc87c064c6d4286e5cc7fbbaecbc650fc","src/connection/tests/stream.rs":"37e91c34851e85763684afceca9a8498101602d629e161d99e10248f3b908a81","src/connection/tests/vn.rs":"ffb1c34be57b2cae704b387a2599cedeb1a8775d5a5e48eb0d0113d767c4e6a6","src/connection/tests/zerortt.rs":"8c5e874b36e34306f640ba7fc760d38847292b399f6eec97b565de12b77cbd76","src/crypto.rs":"ed07cd03f9bcbbcba770f42062e72b2957bf1fb098c77d23e7a03c4ddc6fe213","src/dump.rs":"d69ccb0e3b240823b886a791186afbac9f2e26d1f1f67a55dbf86f8cd3e6203e","src/events.rs":"6d1e168eb8c425018281e82ba3ff05ea0321035eb677f1d1bdd19fe32c1e62ce","src/flow_mgr.rs":"4f667a5b8574c248e7422aaac3492d89f4a2e7e202a19083b9f84cf129e49037","src/frame.rs":"d2d175fb058c4157c8717595784c2ab26df8ae9b5e2ba2e99d579203314991c0","src/lib.rs":"580c2065f035c5759d3ee9f735ade6dbf86a5351000a4e86f61fa40001e00c27","src/pace.rs":"eb9094cfcae54162022f70f230b6a9811add0063b878100f147a9365473f6612","src/packet/mod.rs":"928e67a595bcbc2512c45374e6b84332832e87a1e4309f72d3f7604c24a76817","src/packet/retry.rs":"670b2d3363121a7a98fb6efe186c3818786093502b53b7d9d104368de3376555","src/path.rs":"92b2701d1e486250f472b2cdc487b1e9e9c8753c9c40b626c2d6d1ccd6e70c38","src/qlog.rs":"b2853fdc7acfb86c8b802a39f32b0462dd82bf86f5c427ffdb523be933268532","src/recovery.rs":"c65092d01e75d640bfb465c36ce9b6285e080da1608a4fe0c83ace64c639254a","src/recv_stream.rs":"71143d3ce2670d55dbc5cf7ecd9d3b5826a3060029162f335fffd197bedf149f","src/send_stream.rs":"4c019d99cdb1ad76bc5434fbde009371a49ef61138e84609595686af8e2ca651","src/sender.rs":"fdb16a6c44473dbd2dce3f0982f467e4cc8af579b9bd2abf2f3444845d2c07d0","src/server.rs":"cdb0eb1e194110a39335e75018b861e34fab855adf76fb218c7b982bd10f7833","src/stats.rs":"4a3b5560dbb6a32414b80cc82c062c9a64e5f7aba75416f0208a2477f355e6f0","src/stream_id.rs":"98f656157e0eeb7f32802cf2b3dbd68ef8d7a89578a097a88db7157d4a712202","src/tparams.rs":"07ee3df53552a281a009fb68972ac9f19a239cd13d1ab48c3b13de07a242c051","src/tracking.rs":"7dfe2f6702609361348eeddfc0ea61b9a58c31d88884adfe5c550d94cdbc2268","tests/conn_vectors.rs":"d5bd7ba17dfd3f7c6fe421ebd346ba7df8ddc08756fa7a747ecba52bcca6a7f0","tests/connection.rs":"fe9b7069b34fea7f5154e9b1ea3bffb290a4aa9a7c97c30992c51fa7a6ad6673","tests/network.rs":"a986c22da7132ec843a44c4bcb5a7d2726132aa27a47a8ea91634cd88e1b763b","tests/server.rs":"9eda88cbf7840b829ae62dcbe2eec381b42a3a00c915cfb371047c60d4677664","tests/sim/connection.rs":"5e65e7247f69ad9d992cffc9daac6a8af360c6c312e6588da07478337a12819f","tests/sim/delay.rs":"9efa722adb89e37262369e9f3c67405f0acc8c24997271811e48df9e856e5a8d","tests/sim/drop.rs":"bd89e5c71cdd1b27cd755faaedd87d5feadf2f424df721a7df41a51bcebcbb58","tests/sim/mod.rs":"9a930682cf92e7279bccdd2145f19ff17f5aa950994e7b3e25749651511c2753","tests/sim/net.rs":"597f4d37bc26c3d82eeeaa6d14dd03bc2be3930686df2b293748b43c07c497d7","tests/sim/rng.rs":"2c90b0bbaf0c952ebee232deb3594f7a86af387737b15474de3e97ee6b623d90","tests/sim/taildrop.rs":"5c505d150f0071e8cc2d540b3a817a6942fdf13df32f1fbc6822952f2e146176"},"package":null}

2
third_party/rust/neqo-transport/Cargo.toml поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
[package]
name = "neqo-transport"
version = "0.4.16"
version = "0.4.18"
authors = ["EKR <ekr@rtfm.com>", "Andy Grover <agrover@mozilla.com>"]
edition = "2018"
license = "MIT/Apache-2.0"

Просмотреть файл

@ -7,7 +7,7 @@
// The class implementing a QUIC connection.
use std::cell::RefCell;
use std::cmp::max;
use std::cmp::{max, min};
use std::collections::HashMap;
use std::convert::TryFrom;
use std::fmt::{self, Debug};
@ -1531,7 +1531,8 @@ impl Connection {
if let CloseError::Transport(_) = error_code {
builder.encode_varint(*frame_type);
}
builder.encode_vvec(reason_phrase);
let reason_len = min(min(reason_phrase.len(), 256), builder.remaining() - 2);
builder.encode_vvec(&reason_phrase[..reason_len]);
} else {
unreachable!();
}

Просмотреть файл

@ -42,6 +42,23 @@ fn connection_close() {
assert_draining(&server, &Error::PeerApplicationError(42));
}
#[test]
fn connection_close_with_long_reason_string() {
let mut client = default_client();
let mut server = default_server();
connect(&mut client, &mut server);
let now = now();
// Create a long string and use it as the close reason.
let long_reason = String::from_utf8([0x61; 2048].to_vec()).unwrap();
client.close(now, 42, long_reason);
let out = client.process(None, now);
server.process_input(out.dgram().unwrap(), now);
assert_draining(&server, &Error::PeerApplicationError(42));
}
// During the handshake, an application close should be sanitized.
#[test]
fn early_application_close() {

Просмотреть файл

@ -521,4 +521,21 @@ mod tests {
assert!(!tps_b.ok_for_0rtt(&tps_a));
}
}
#[test]
fn active_connection_id_limit_lt_2_is_error() {
let mut tps = TransportParameters::default();
// Intentionally set an invalid value for the ACTIVE_CONNECTION_ID_LIMIT transport parameter.
tps.params
.insert(ACTIVE_CONNECTION_ID_LIMIT, TransportParameter::Integer(1));
let mut enc = Encoder::default();
tps.encode(&mut enc);
// When decoding a set of transport parameters with an invalid ACTIVE_CONNECTION_ID_LIMIT
// the result should be an error.
let invalid_decode_result = TransportParameters::decode(&mut enc.as_decoder());
assert!(invalid_decode_result.is_err());
}
}