| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/; |
| 2 | |
| 3 | use clang_sysrust-analyzer cargo clang-sys 1.8.1 crate/::*; |
| 4 | |
| 5 | use libcrust-analyzer cargo libc 0.2.189 crate/::c_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#; |
| 6 | |
| 7 | fn parserust-analyzer cargo clang-sys 1.8.1 parse().() { |
| 8 | unsafe { |
| 9 | let index = clang_createIndexrust-analyzer cargo clang-sys 1.8.1 clang_createIndex().(0, 0); |
| 10 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().index.is_nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]is_null().()); |
| 11 | |
| 12 | let tu = clang_parseTranslationUnitrust-analyzer cargo clang-sys 1.8.1 clang_parseTranslationUnit().( |
| 13 | index, |
| 14 | "tests/header.h\0".as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_ptr().() as *const c_charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_char#, |
| 15 | ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().(), |
| 16 | 0, |
| 17 | ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::null_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null_mut().(), |
| 18 | 0, |
| 19 | 0, |
| 20 | ); |
| 21 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().tu.is_nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]is_null().()); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | #[cfg(feature = "runtime")] |
| 26 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 27 | fn testrust-analyzer cargo clang-sys 1.8.1 test().() { |
| 28 | loadrust-analyzer cargo clang-sys 1.8.1 load().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 29 | let library = get_libraryrust-analyzer cargo clang-sys 1.8.1 get_library().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 30 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?} ({:?})", library.versionrust-analyzer cargo clang-sys 1.8.1 impl#[SharedLibrary]version().(), library.pathrust-analyzer cargo clang-sys 1.8.1 impl#[SharedLibrary]path().()); |
| 31 | parserust-analyzer cargo clang-sys 1.8.1 parse().(); |
| 32 | unloadrust-analyzer cargo clang-sys 1.8.1 unload().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 33 | } |
| 34 | |
| 35 | #[cfg(not(feature = "runtime"))] |
| 36 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 37 | fn test() { |
| 38 | parserust-analyzer cargo clang-sys 1.8.1 parse().(); |
| 39 | } |
| 40 | |
| 41 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 42 | fn test_supportrust-analyzer cargo clang-sys 1.8.1 test_support().() { |
| 43 | let clang = supportrust-analyzer cargo clang-sys 1.8.1 support/::Clangrust-analyzer cargo clang-sys 1.8.1 support/Clang#::findrust-analyzer cargo clang-sys 1.8.1 support/impl#[Clang]find().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, &[]).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 44 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", clang); |
| 45 | } |
| 46 | |
| 47 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 48 | fn test_support_targetrust-analyzer cargo clang-sys 1.8.1 test_support_target().() { |
| 49 | let args = &["--target".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "x86_64-unknown-linux-gnu".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()]; |
| 50 | let clang = supportrust-analyzer cargo clang-sys 1.8.1 support/::Clangrust-analyzer cargo clang-sys 1.8.1 support/Clang#::findrust-analyzer cargo clang-sys 1.8.1 support/impl#[Clang]find().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, args).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 51 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", clang); |
| 52 | } |