Lines Matching +full:libclang +full:- +full:version
8 //! See the [Users Guide](https://rust-lang.github.io/rust-bindgen/) for
90 fn file_is_cpp(name_file: &str) -> bool { in file_is_cpp()
97 fn args_are_cpp(clang_args: &[Box<str>]) -> bool { in args_are_cpp()
99 if w[0].as_ref() == "-xc++" || w[1].as_ref() == "-xc++" { in args_are_cpp()
102 if w[0].as_ref() == "-x" && w[1].as_ref() == "c++" { in args_are_cpp()
105 if w[0].as_ref() == "-include" && file_is_cpp(w[1].as_ref()) { in args_are_cpp()
133 pub fn functions(self) -> bool { in functions()
138 pub fn types(self) -> bool { in types()
143 pub fn vars(self) -> bool { in vars()
148 pub fn methods(self) -> bool { in methods()
153 pub fn constructors(self) -> bool { in constructors()
158 pub fn destructors(self) -> bool { in destructors()
164 fn default() -> Self { in default()
183 fn default() -> Self { in default()
191 fn from_str(s: &str) -> Result<Self, Self::Err> { in from_str()
203 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { in fmt()
262 /// End-users of the crate may need to set the `BINDGEN_EXTRA_CLANG_ARGS` environment variable to
264 /// `BINDGEN_EXTRA_CLANG_ARGS` to `--sysroot=/path/to/sysroot`.
282 /// Additionally, Objective-C interfaces can be matched by prefixing the regular expression with
286 /// Releases of `bindgen` with a version lesser or equal to `0.62.0` used to accept the wildcard
295 pub fn builder() -> Builder { in builder()
301 ) -> Vec<String> { in get_extra_clang_args()
320 pub fn generate(mut self) -> Result<Bindings, BindgenError> { in generate()
338 .flat_map(|header| ["-include".into(), header.clone()]), in generate()
354 /// This is useful when debugging bindgen, using C-Reduce, or when filing
357 pub fn dump_preprocessed_input(&self) -> io::Result<()> { in dump_preprocessed_input()
405 cmd.arg("-save-temps") in dump_preprocessed_input()
406 .arg("-E") in dump_preprocessed_input()
407 .arg("-C") in dump_preprocessed_input()
408 .arg("-c") in dump_preprocessed_input()
435 "clang exited with non-zero status", in dump_preprocessed_input()
482 "--blocklist-type", in build()
483 "--blocklist-function", in build()
484 "--blocklist-item", in build()
485 "--blocklist-file", in build()
486 "--opaque-type", in build()
487 "--allowlist-type", in build()
488 "--allowlist-function", in build()
489 "--allowlist-var", in build()
490 "--allowlist-file", in build()
491 "--allowlist-item", in build()
492 "--bitfield-enum", in build()
493 "--newtype-enum", in build()
494 "--newtype-global-enum", in build()
495 "--rustified-enum", in build()
496 "--rustified-enum-non-exhaustive", in build()
497 "--constified-enum-module", in build()
498 "--constified-enum", in build()
499 "--type-alias", in build()
500 "--new-type-alias", in build()
501 "--new-type-alias-deref", in build()
502 "--bindgen-wrapper-union", in build()
503 "--manually-drop-union", in build()
504 "--no-partialeq", in build()
505 "--no-copy", in build()
506 "--no-debug", in build()
507 "--no-default", in build()
508 "--no-hash", in build()
509 "--must-use", in build()
511 .chain((0..self.abi_overrides.len()).map(|_| "--override-abi")) in build()
541 /// Update rust target version
549 /// Get features supported by target Rust version
550 pub fn rust_features(&self) -> RustFeatures { in rust_features()
556 f: impl Fn(&dyn callbacks::ParseCallbacks) -> Option<T>, in last_callback()
557 ) -> Option<T> { in last_callback()
566 f: impl Fn(&dyn callbacks::ParseCallbacks) -> Vec<T>, in all_callbacks()
567 ) -> Vec<T> { in all_callbacks()
578 fn process_comment(&self, comment: &str) -> String { in process_comment()
588 …e a need to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues",… in deprecated_target_diagnostic()
600 "This Rust target was passed to `--rust-target`", in deprecated_target_diagnostic()
603 …d reason to use this target please report it at https://github.com/rust-lang/rust-bindgen/issues",… in deprecated_target_diagnostic()
614 // XXX (issue #350): Ensure that our dynamically loaded `libclang` in ensure_libclang_is_loaded()
619 static ref LIBCLANG: std::sync::Arc<clang_sys::SharedLibrary> = { in ensure_libclang_is_loaded()
620 clang_sys::load().expect("Unable to find libclang"); in ensure_libclang_is_loaded()
622 "We just loaded libclang and it had better still be \ in ensure_libclang_is_loaded()
628 clang_sys::set_library(Some(LIBCLANG.clone())); in ensure_libclang_is_loaded()
634 /// Error type for rust-bindgen.
651 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { in fmt()
682 include_str!(concat!(env!("OUT_DIR"), "/host-target.txt"));
684 // Some architecture triplets are different between rust and libclang, see #1211
686 fn rust_to_clang_target(rust_target: &str) -> Box<str> { in rust_to_clang_target()
687 if rust_target.starts_with("aarch64-apple-") { in rust_to_clang_target()
688 let mut clang_target = "arm64-apple-".to_owned(); in rust_to_clang_target()
690 .push_str(rust_target.strip_prefix("aarch64-apple-").unwrap()); in rust_to_clang_target()
692 } else if rust_target.starts_with("riscv64gc-") { in rust_to_clang_target()
693 let mut clang_target = "riscv64-".to_owned(); in rust_to_clang_target()
694 clang_target.push_str(rust_target.strip_prefix("riscv64gc-").unwrap()); in rust_to_clang_target()
696 } else if rust_target.ends_with("-espidf") { in rust_to_clang_target()
698 rust_target.strip_suffix("-espidf").unwrap().to_owned(); in rust_to_clang_target()
699 clang_target.push_str("-elf"); in rust_to_clang_target()
700 if clang_target.starts_with("riscv32imc-") { in rust_to_clang_target()
701 clang_target = "riscv32-".to_owned() + in rust_to_clang_target()
702 clang_target.strip_prefix("riscv32imc-").unwrap(); in rust_to_clang_target()
705 } else if rust_target.starts_with("riscv32imc-") { in rust_to_clang_target()
706 let mut clang_target = "riscv32-".to_owned(); in rust_to_clang_target()
707 clang_target.push_str(rust_target.strip_prefix("riscv32imc-").unwrap()); in rust_to_clang_target()
709 } else if rust_target.starts_with("riscv32imac-") { in rust_to_clang_target()
710 let mut clang_target = "riscv32-".to_owned(); in rust_to_clang_target()
712 .push_str(rust_target.strip_prefix("riscv32imac-").unwrap()); in rust_to_clang_target()
720 fn find_effective_target(clang_args: &[Box<str>]) -> (Box<str>, bool) { in find_effective_target()
723 if opt.starts_with("--target=") { in find_effective_target()
729 if opt.as_ref() == "-target" { in find_effective_target()
749 ) -> Result<Bindings, BindgenError> { in generate()
754 "Generating bindings, libclang at {}", in generate()
758 debug!("Generating bindings, libclang linked"); in generate()
769 // cases if we were to call a binary (if you have a 32-bit clang and are in generate()
770 // building on a 64-bit system for example). But since we rely on in generate()
771 // opening libclang.so, it has to be the same architecture and thus the in generate()
776 format!("--target={}", effective_target).into_boxed_str(), in generate()
786 // promote them to `-isystem`. in generate()
801 // -isystem and -isystem-after are harmless. in generate()
802 if arg == "-I" || arg == "--include-directory" { in generate()
807 if arg.starts_with("-I") || in generate()
808 arg.starts_with("--include-directory=") in generate()
847 options.clang_args.push("-isystem".into()); in generate()
857 fn can_read(perms: &std::fs::Permissions) -> bool { in generate()
863 fn can_read(_: &std::fs::Permissions) -> bool { in generate()
886 options.clang_args.push("-include".into()); in generate()
891 debug!("Fixed-up options: {:?}", options); in generate()
918 pub fn write_to_file<P: AsRef<Path>>(&self, path: P) -> io::Result<()> { in write_to_file()
929 pub fn write<'a>(&self, mut writer: Box<dyn Write + 'a>) -> io::Result<()> { in write()
931 let version = in write() localVariable
932 Some("0.69.1").unwrap_or("(unknown version)"); in write()
934 "/* automatically generated by rust-bindgen {version} */\n\n", in write()
954 "Failed to run rustfmt: {} (non-fatal, continuing)", in write()
964 fn rustfmt_path(&self) -> io::Result<Cow<PathBuf>> { in rustfmt_path()
972 #[cfg(feature = "which-rustfmt")] in rustfmt_path()
979 #[cfg(not(feature = "which-rustfmt"))] in rustfmt_path()
989 ) -> io::Result<String> { in format_tokens()
1013 cmd.args(["--config-path", path]); in format_tokens()
1081 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { in fmt()
1087 .expect("we should only write bindings that are valid utf-8"), in fmt()
1094 fn filter_builtins(ctx: &BindgenContext, cursor: &clang::Cursor) -> bool { in filter_builtins()
1119 fn parse(context: &mut BindgenContext) -> Result<(), BindgenError> { in parse()
1142 fn dump_if_not_builtin(cur: &clang::Cursor) -> CXChildVisitResult { in parse()
1164 /// Extracted Clang version data
1169 /// full version string
1173 /// Get the major and the minor semver numbers of Clang's version
1174 pub fn clang_version() -> ClangVersion { in clang_version()
1177 //Debian clang version 11.0.1-2 in clang_version()
1204 ) -> Result<String, std::env::VarError> { in env_var()
1215 ) -> Option<String> { in get_target_dependent_env_var()
1222 format!("{}_{}", var, target.replace('-', "_")), in get_target_dependent_env_var()
1231 /// A ParseCallbacks implementation that will act on file includes by echoing a rerun-if-changed
1232 /// line and on env variable usage by echoing a rerun-if-env-changed line
1259 pub fn new() -> Self { in new()
1265 /// Whether Cargo should re-run the build script if any of the input header files has changed.
1269 pub fn rerun_on_header_files(mut self, doit: bool) -> Self { in rerun_on_header_files()
1276 fn default() -> Self { in default()
1284 println!("cargo:rerun-if-changed={}", filename); in header_file()
1289 println!("cargo:rerun-if-changed={}", filename); in include_file()
1293 println!("cargo:rerun-if-env-changed={}", key); in read_env_var()
1305 "--rust-target", in commandline_flag_unit_test_function()
1306 "--no-derive-default", in commandline_flag_unit_test_function()
1307 "--generate", in commandline_flag_unit_test_function()
1324 "--rust-target", in commandline_flag_unit_test_function()
1326 "--no-derive-default", in commandline_flag_unit_test_function()
1327 "--generate", in commandline_flag_unit_test_function()
1329 "--allowlist-type", in commandline_flag_unit_test_function()
1331 "--allowlist-function", in commandline_flag_unit_test_function()
1345 rust_to_clang_target("aarch64-apple-ios").as_ref(), in test_rust_to_clang_target()
1346 "arm64-apple-ios" in test_rust_to_clang_target()
1353 rust_to_clang_target("riscv64gc-unknown-linux-gnu").as_ref(), in test_rust_to_clang_target_riscv()
1354 "riscv64-unknown-linux-gnu" in test_rust_to_clang_target_riscv()
1357 rust_to_clang_target("riscv32imc-unknown-none-elf").as_ref(), in test_rust_to_clang_target_riscv()
1358 "riscv32-unknown-none-elf" in test_rust_to_clang_target_riscv()
1361 rust_to_clang_target("riscv32imac-unknown-none-elf").as_ref(), in test_rust_to_clang_target_riscv()
1362 "riscv32-unknown-none-elf" in test_rust_to_clang_target_riscv()
1369 rust_to_clang_target("riscv32imc-esp-espidf").as_ref(), in test_rust_to_clang_target_espidf()
1370 "riscv32-esp-elf" in test_rust_to_clang_target_espidf()
1373 rust_to_clang_target("xtensa-esp32-espidf").as_ref(), in test_rust_to_clang_target_espidf()
1374 "xtensa-esp32-elf" in test_rust_to_clang_target_espidf()