aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:14:45 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:14:45 +0000
commit8b7583310df66aae829bcf9edd5c3689d3b67541 (patch)
tree334fd6e38058959267982478978c59181f6b8f4f
parent6890dd6e12e7206b0214e3c1178f3f852ec37437 (diff)
parentb48c793480a782bf3347d6bae89b3e1d9ac1f787 (diff)
downloadclang-sys-android14-mainline-uwb-release.tar.gz
Change-Id: Ica449d474be81ececf82de912811a88186833cf0
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--Android.bp4
-rw-r--r--CHANGELOG.md24
-rw-r--r--Cargo.toml13
-rw-r--r--Cargo.toml.orig7
-rw-r--r--METADATA12
-rw-r--r--README.md8
-rw-r--r--TEST_MAPPING14
-rw-r--r--build/common.rs8
-rw-r--r--out/common.rs8
-rw-r--r--src/lib.rs45
-rw-r--r--src/support.rs5
13 files changed, 125 insertions, 27 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index ac25bc0..d04b5e7 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
{
"git": {
- "sha1": "8090d6853624a04b859e8ab2e467bae88a8d4ef6"
+ "sha1": "1b9b8a71748aebd26180f1f16728ef111afce5ad"
},
"path_in_vcs": ""
} \ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5bd0a2a..646f4c2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
- clang: [["13.0", "clang_13_0"]]
+ clang: [["14.0", "clang_14_0"]]
rust: ["1.40.0"]
steps:
- name: Checkout Repository
diff --git a/Android.bp b/Android.bp
index 197c57a..1e197b2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -32,7 +32,7 @@ rust_library_host {
name: "libclang_sys",
crate_name: "clang_sys",
cargo_env_compat: true,
- cargo_pkg_version: "1.3.1",
+ cargo_pkg_version: "1.4.0",
srcs: [
"src/lib.rs",
":copy_clang-sys_build_out",
@@ -59,4 +59,6 @@ rust_library_host {
"liblibc",
"liblibloading",
],
+ product_available: true,
+ vendor_available: true,
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 681cde4..d697220 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,27 @@
+## [1.4.0] - 2022-09-22
+
+### Changed
+- The value of an `EntityKind` enum variant
+(`EntityKind::CXCursor_TranslationUnit`) has been updated for Clang 15.0 and
+later to match the
+[breaking change made in `libclang`](https://github.com/llvm/llvm-project/commit/bb83f8e70bd1d56152f02307adacd718cd67e312#diff-674613a0e47f4e66cc19061e28e3296d39be2d124dceefb68237b30b8e241e7c)
+
+### Added
+- Added support for `clang` 16.0.x
+- Added support for `clang` 15.0.x
+- Added support for `clang` 14.0.x
+
+## [1.3.3] - 2022-05-28
+
+### Fixed
+- Fixed `Clang::find` to check that `CLANG_PATH` is an executable file before
+selecting it
+
+## [1.3.2] - 2022-05-18
+
+### Added
+- Added support for illumos and derivatives
+
## [1.3.1] - 2022-02-03
### Added
diff --git a/Cargo.toml b/Cargo.toml
index 3f4fe6d..a0d9cbb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@
[package]
name = "clang-sys"
-version = "1.3.1"
+version = "1.4.0"
authors = ["Kyle Mayes <kyle@mayeses.com>"]
build = "build.rs"
links = "clang"
@@ -20,8 +20,13 @@ 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_13_0", "runtime"]
+features = [
+ "clang_16_0",
+ "runtime",
+]
+
[dependencies.glob]
version = "0.3"
@@ -32,6 +37,7 @@ default-features = false
[dependencies.libloading]
version = "0.7"
optional = true
+
[build-dependencies.glob]
version = "0.3"
@@ -40,6 +46,9 @@ clang_10_0 = ["clang_9_0"]
clang_11_0 = ["clang_10_0"]
clang_12_0 = ["clang_11_0"]
clang_13_0 = ["clang_12_0"]
+clang_14_0 = ["clang_13_0"]
+clang_15_0 = ["clang_14_0"]
+clang_16_0 = ["clang_15_0"]
clang_3_5 = []
clang_3_6 = ["clang_3_5"]
clang_3_7 = ["clang_3_6"]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index a78a106..1041981 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -3,7 +3,7 @@
name = "clang-sys"
authors = ["Kyle Mayes <kyle@mayeses.com>"]
-version = "1.3.1"
+version = "1.4.0"
readme = "README.md"
license = "Apache-2.0"
@@ -33,6 +33,9 @@ clang_10_0 = ["clang_9_0"]
clang_11_0 = ["clang_10_0"]
clang_12_0 = ["clang_11_0"]
clang_13_0 = ["clang_12_0"]
+clang_14_0 = ["clang_13_0"]
+clang_15_0 = ["clang_14_0"]
+clang_16_0 = ["clang_15_0"]
runtime = ["libloading"]
static = []
@@ -49,4 +52,4 @@ glob = "0.3"
[package.metadata.docs.rs]
-features = ["clang_13_0", "runtime"]
+features = ["clang_16_0", "runtime"]
diff --git a/METADATA b/METADATA
index c8b71ff..ac49596 100644
--- a/METADATA
+++ b/METADATA
@@ -1,3 +1,7 @@
+# This project was upgraded with external_updater.
+# Usage: tools/external_updater/updater.sh update rust/crates/clang-sys
+# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+
name: "clang-sys"
description: "Rust bindings for libclang."
third_party {
@@ -7,13 +11,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/clang-sys/clang-sys-1.3.1.crate"
+ value: "https://static.crates.io/crates/clang-sys/clang-sys-1.4.0.crate"
}
- version: "1.3.1"
+ version: "1.4.0"
license_type: NOTICE
last_upgrade_date {
year: 2022
- month: 3
- day: 1
+ month: 12
+ day: 8
}
}
diff --git a/README.md b/README.md
index dd73945..ed5f52e 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Released under the Apache License 2.0.
## [Documentation](https://docs.rs/clang-sys)
-Note that the documentation on https://docs.rs for this crate assumes usage of the `runtime` Cargo feature as well as the Cargo feature for the latest supported version of `libclang` (e.g., `clang_13_0`), neither of which are enabled by default.
+Note that the documentation on https://docs.rs for this crate assumes usage of the `runtime` Cargo feature as well as the Cargo feature for the latest supported version of `libclang` (e.g., `clang_16_0`), neither of which are enabled by default.
Due to the usage of the `runtime` Cargo feature, this documentation will contain some additional types and functions to manage a dynamically loaded `libclang` instance at runtime.
@@ -26,11 +26,13 @@ To target a version of `libclang`, enable a Cargo features such as one of the fo
* `clang_3_5` - requires `libclang` 3.5 or later
* `clang_3_6` - requires `libclang` 3.6 or later
* etc...
-* `clang_12_0` - requires `libclang` 12.0 or later
-* `clang_13_0` - requires `libclang` 13.0 or later
+* `clang_15_0` - requires `libclang` 15.0 or later
+* `clang_16_0` - requires `libclang` 16.0 or later
If you do not enable one of these features, the API provided by `libclang` 3.5 will be available by default.
+**Note:** If you are using Clang 15.0 or later, you should enable the `clang_15_0` feature or a more recent version feature. Clang 15.0 introduced [a breaking change to the `EntityKind` enum](https://github.com/llvm/llvm-project/commit/bb83f8e70bd1d56152f02307adacd718cd67e312#diff-674613a0e47f4e66cc19061e28e3296d39be2d124dceefb68237b30b8e241e7c) which resulted in a mismatch between the values returned by `libclang` and the values for `EntityKind` defined by this crate in previous versions.
+
## Dependencies
By default, this crate will attempt to link to `libclang` dynamically. In this case, this crate depends on the `libclang` shared library (`libclang.so` on Linux, `libclang.dylib` on macOS, `libclang.dll` on Windows). If you want to link to `libclang` statically instead, enable the `static` Cargo feature. In this case, this crate depends on the LLVM and Clang static libraries. If you don't want to link to `libclang` at compiletime but instead want to load it at runtime, enable the `runtime` Cargo feature.
diff --git a/TEST_MAPPING b/TEST_MAPPING
index e4ec3b3..23bbdf9 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -3,22 +3,12 @@
"imports": [
{
"path": "external/rust/crates/libsqlite3-sys"
- }
- ],
- "presubmit": [
- {
- "name": "keystore2_test"
},
{
- "name": "legacykeystore_test"
- }
- ],
- "presubmit-rust": [
- {
- "name": "keystore2_test"
+ "path": "system/security/keystore2"
},
{
- "name": "legacykeystore_test"
+ "path": "system/security/keystore2/legacykeystore"
}
]
}
diff --git a/build/common.rs b/build/common.rs
index bc720ca..735d5da 100644
--- a/build/common.rs
+++ b/build/common.rs
@@ -172,6 +172,12 @@ const DIRECTORIES_WINDOWS: &[&str] = &[
"C:\\Users\\*\\scoop\\apps\\llvm\\current\\bin",
];
+/// `libclang` directory patterns for illumos
+const DIRECTORIES_ILLUMOS: &[&str] = &[
+ "/opt/ooce/clang-*/lib",
+ "/opt/ooce/llvm-*/lib",
+];
+
//================================================
// Searching
//================================================
@@ -291,6 +297,8 @@ pub fn search_libclang_directories(filenames: &[String], variable: &str) -> Vec<
DIRECTORIES_MACOS
} else if cfg!(target_os = "windows") {
DIRECTORIES_WINDOWS
+ } else if cfg!(target_os = "illumos") {
+ DIRECTORIES_ILLUMOS
} else {
&[]
};
diff --git a/out/common.rs b/out/common.rs
index bc720ca..735d5da 100644
--- a/out/common.rs
+++ b/out/common.rs
@@ -172,6 +172,12 @@ const DIRECTORIES_WINDOWS: &[&str] = &[
"C:\\Users\\*\\scoop\\apps\\llvm\\current\\bin",
];
+/// `libclang` directory patterns for illumos
+const DIRECTORIES_ILLUMOS: &[&str] = &[
+ "/opt/ooce/clang-*/lib",
+ "/opt/ooce/llvm-*/lib",
+];
+
//================================================
// Searching
//================================================
@@ -291,6 +297,8 @@ pub fn search_libclang_directories(filenames: &[String], variable: &str) -> Vec<
DIRECTORIES_MACOS
} else if cfg!(target_os = "windows") {
DIRECTORIES_WINDOWS
+ } else if cfg!(target_os = "illumos") {
+ DIRECTORIES_ILLUMOS
} else {
&[]
};
diff --git a/src/lib.rs b/src/lib.rs
index 863fa86..c101ce6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -127,6 +127,8 @@ cenum! {
const CXCallingConv_Unexposed = 200,
/// Only produced by `libclang` 13.0 and later.
const CXCallingConv_SwiftAsync = 17,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCallingConv_AArch64SVEPCS = 18,
}
}
@@ -321,6 +323,10 @@ cenum! {
const CXCursor_OMPIteratorExpr = 151,
/// Only produced by `libclang` 12.0 and later.
const CXCursor_CXXAddrspaceCastExpr = 152,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_ConceptSpecializationExpr = 153,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_RequiresExpr = 154,
const CXCursor_UnexposedStmt = 200,
const CXCursor_LabelStmt = 201,
const CXCursor_CompoundStmt = 202,
@@ -462,7 +468,32 @@ cenum! {
const CXCursor_OMPMaskedDirective = 292,
/// Only produced by `libclang` 13.0 and later.
const CXCursor_OMPUnrollDirective = 293,
+ /// Only produced by `libclang` 14.0 and later.
+ const CXCursor_OMPMetaDirective = 294,
+ /// Only produced by `libclang` 14.0 and later.
+ const CXCursor_OMPGenericLoopDirective = 295,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_OMPTeamsGenericLoopDirective = 296,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_OMPTargetTeamsGenericLoopDirective = 297,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_OMPParallelGenericLoopDirective = 298,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_OMPTargetParallelGenericLoopDirective = 299,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_OMPParallelMaskedDirective = 300,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_OMPMaskedTaskLoopDirective = 301,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_OMPMaskedTaskLoopSimdDirective = 302,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_OMPParallelMaskedTaskLoopDirective = 303,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_OMPParallelMaskedTaskLoopSimdDirective = 304,
+ #[cfg(not(feature="clang_15_0"))]
const CXCursor_TranslationUnit = 300,
+ #[cfg(feature="clang_15_0")]
+ const CXCursor_TranslationUnit = 350,
const CXCursor_UnexposedAttr = 400,
const CXCursor_IBActionAttr = 401,
const CXCursor_IBOutletAttr = 402,
@@ -543,6 +574,8 @@ cenum! {
const CXCursor_StaticAssert = 602,
/// Only produced by `libclang` 4.0 and later.
const CXCursor_FriendDecl = 603,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXCursor_ConceptDecl = 604,
/// Only produced by `libclang` 3.7 and later.
const CXCursor_OverloadCandidate = 700,
}
@@ -646,6 +679,8 @@ cenum! {
const CXIdxEntity_CXXConversionFunction = 24,
const CXIdxEntity_CXXTypeAlias = 25,
const CXIdxEntity_CXXInterface = 26,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXIdxEntity_CXXConcept = 27,
}
}
@@ -869,6 +904,8 @@ cenum! {
const CXType_ULongAccum = 38,
/// Only produced by `libclang` 11.0 and later.
const CXType_BFloat16 = 39,
+ /// Only produced by `libclang` 14.0 and later.
+ const CXType_Ibm128 = 40,
const CXType_Complex = 100,
const CXType_Pointer = 101,
const CXType_BlockPointer = 102,
@@ -1007,6 +1044,8 @@ cenum! {
const CXType_ExtVector = 176,
/// Only produced by `libclang` 11.0 and later.
const CXType_Atomic = 177,
+ /// Only produced by `libclang` 15.0 and later.
+ const CXType_BTFTagAttributed = 178,
}
}
@@ -2129,6 +2168,12 @@ link! {
/// Only available on `libclang` 5.0 and later.
#[cfg(feature = "clang_5_0")]
pub fn clang_getTranslationUnitTargetInfo(tu: CXTranslationUnit) -> CXTargetInfo;
+ /// Only available on `libclang` 16.0 and later.
+ #[cfg(feature = "clang_16_0")]
+ pub fn clang_getUnqualifiedType(type_: CXType) -> CXType;
+ /// Only available on `libclang` 16.0 and later.
+ #[cfg(feature = "clang_16_0")]
+ pub fn clang_getNonReferenceType(type_: CXType) -> CXType;
pub fn clang_getTypeDeclaration(type_: CXType) -> CXCursor;
pub fn clang_getTypeKindSpelling(type_: CXTypeKind) -> CXString;
pub fn clang_getTypeSpelling(type_: CXType) -> CXString;
diff --git a/src/support.rs b/src/support.rs
index ff38d39..2b27cc0 100644
--- a/src/support.rs
+++ b/src/support.rs
@@ -58,7 +58,10 @@ impl Clang {
/// `x86_64-unknown-linux-gnu-clang` for the above example).
pub fn find(path: Option<&Path>, args: &[String]) -> Option<Clang> {
if let Ok(path) = env::var("CLANG_PATH") {
- return Some(Clang::new(path, args));
+ let p = Path::new(&path);
+ if p.is_file() && is_executable(&p).unwrap_or(false) {
+ return Some(Clang::new(p, args));
+ }
}
// Determine the cross-compilation target, if any.