summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXidorn Quan <me@upsuper.org>2017-07-31 15:09:54 +1000
committerXidorn Quan <me@upsuper.org>2017-07-31 15:48:54 +1000
commit90dfdf2af639e45ebc54232c3c79c077b0c86dca (patch)
treed57bae91eb1f96892a98d617ecb490d4fd0f0209 /src
parent3a9a6759ec1d5149fb3a2999f8a05e659b9c02a8 (diff)
Stablize name of pointer and array
Diffstat (limited to 'src')
-rw-r--r--src/ir/item.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/ir/item.rs b/src/ir/item.rs
index 92954a8f..80e63ffe 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -742,12 +742,21 @@ impl Item {
ItemKind::Type(ref ty) => {
let name = match *ty.kind() {
TypeKind::ResolvedTypeRef(..) => panic!("should have resolved this in name_target()"),
- _ => ty.name(),
+ TypeKind::Pointer(inner) => {
+ ctx.resolve_item(inner)
+ .expect_type().name()
+ .map(|name| format!("ptr_{}", name))
+ }
+ TypeKind::Array(inner, length) => {
+ ctx.resolve_item(inner)
+ .expect_type().name()
+ .map(|name| format!("array_{}_{}", name, length))
+ }
+ _ => ty.name().map(ToOwned::to_owned)
};
- name.map(ToOwned::to_owned)
- .unwrap_or_else(|| {
- format!("_bindgen_ty_{}", self.exposed_id(ctx))
- })
+ name.unwrap_or_else(|| {
+ format!("_bindgen_ty_{}", self.exposed_id(ctx))
+ })
}
ItemKind::Function(ref fun) => {
let mut name = fun.name().to_owned();