Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demonstrate dropping support for libclang < 5.0 #1807

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .github/workflows/bindgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- debian: null
cross: null
rust: null
llvm_version: ["4.0", "5.0", "9.0"]
llvm_version: ["5.0", "9.0"]
main_tests: [1]
release_build: [0, 1]
no_default_features: [0, 1]
Expand All @@ -109,14 +109,6 @@ jobs:
feature_extra_asserts: [0]
feature_testing_only_docs: [0]

exclude:
# 4.0 is too old to support regular dynamic linking, so this
# is not expected to work.
- os: ubuntu-latest
llvm_version: "4.0"
no_default_features: 1
feature_runtime: 0

include:
# Test with extra asserts + docs just with latest llvm versions to
# prevent explosion
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,3 @@ testing_only_docs = []
testing_only_extra_assertions = []
testing_only_libclang_9 = []
testing_only_libclang_5 = []
testing_only_libclang_4 = []
6 changes: 0 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@ environment:
RUST_BACKTRACE: 1
RUST_CHANNEL: "%Configuration%"
matrix:
- TARGET: gnu
LLVM_VERSION: 4.0.0-1
BINDGEN_FEATURES: testing_only_libclang_4
- TARGET: gnu
LLVM_VERSION: 5.0.0-1
BINDGEN_FEATURES: testing_only_libclang_5
- TARGET: gnu
LLVM_VERSION: 9.0.0-1
BINDGEN_FEATURES: testing_only_libclang_9
- TARGET: msvc
LLVM_VERSION: 4.0.0
BINDGEN_FEATURES: testing_only_libclang_4
- TARGET: msvc
LLVM_VERSION: 5.0.0
BINDGEN_FEATURES: testing_only_libclang_5
Expand Down
1 change: 0 additions & 1 deletion bindgen-integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ testing_only_docs = ["bindgen/testing_only_docs"]
testing_only_extra_assertions = ["bindgen/testing_only_extra_assertions"]
testing_only_libclang_9 = ["bindgen/testing_only_libclang_9"]
testing_only_libclang_5 = ["bindgen/testing_only_libclang_5"]
testing_only_libclang_4 = ["bindgen/testing_only_libclang_4"]
9 changes: 3 additions & 6 deletions src/clang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2065,10 +2065,7 @@ pub struct TargetInfo {

impl TargetInfo {
/// Tries to obtain target information from libclang.
pub fn new(tu: &TranslationUnit) -> Option<Self> {
if !clang_getTranslationUnitTargetInfo::is_loaded() {
return None;
}
pub fn new(tu: &TranslationUnit) -> Self {
let triple;
let pointer_width;
unsafe {
Expand All @@ -2079,9 +2076,9 @@ impl TargetInfo {
}
assert!(pointer_width > 0);
assert_eq!(pointer_width % 8, 0);
Some(TargetInfo {
TargetInfo {
triple,
pointer_width: pointer_width as usize,
})
}
}
}
12 changes: 3 additions & 9 deletions src/ir/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ pub struct BindgenContext {
translation_unit: clang::TranslationUnit,

/// Target information that can be useful for some stuff.
target_info: Option<clang::TargetInfo>,
target_info: clang::TargetInfo,

/// The options given by the user via cli or other medium.
options: BindgenOptions,
Expand Down Expand Up @@ -584,10 +584,7 @@ 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,
}
self.target_info.triple.starts_with("wasm32-")
}

/// Creates a timer for the current bindgen phase. If time_phases is `true`,
Expand All @@ -600,10 +597,7 @@ If you encounter an error missing from this list, please file an issue or a PR!"
/// Returns the pointer width to use for the target for the current
/// translation.
pub fn target_pointer_size(&self) -> usize {
if let Some(ref ti) = self.target_info {
return ti.pointer_width / 8;
}
mem::size_of::<*mut ()>()
return self.target_info.pointer_width / 8;
}

/// Get the stack of partially parsed types that we are in the middle of
Expand Down
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ fn clang_version_check() {
Some((9, 0))
} else if cfg!(feature = "testing_only_libclang_5") {
Some((5, 0))
} else if cfg!(feature = "testing_only_libclang_4") {
Some((4, 0))
} else {
None
};
Expand Down
1 change: 0 additions & 1 deletion tests/expectations/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::io::Write;
use std::path::Path;

const LIBCLANG_VERSION_DIRS: &'static [&'static str] = &[
"libclang-4",
"libclang-5",
"libclang-9",
];
Expand Down
11 changes: 0 additions & 11 deletions tests/expectations/tests/libclang-4/abi_variadic_function.rs

This file was deleted.

35 changes: 0 additions & 35 deletions tests/expectations/tests/libclang-4/auto.rs

This file was deleted.

60 changes: 0 additions & 60 deletions tests/expectations/tests/libclang-4/call-conv-field.rs

This file was deleted.

29 changes: 0 additions & 29 deletions tests/expectations/tests/libclang-4/const_bool.rs

This file was deleted.

25 changes: 0 additions & 25 deletions tests/expectations/tests/libclang-4/constant-evaluate.rs

This file was deleted.

This file was deleted.

This file was deleted.

Loading