Skip to content

Commit 2d94347

Browse files
author
bors-servo
authored
Auto merge of #34 - upsuper:blacklist-typedef, r=emilio
Allow blacklist typedef This allows making type aliases to be blacklisted.
2 parents f64606f + 5c67b7d commit 2d94347

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/gen.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,10 @@ fn ctypedef_to_rs(ctx: &mut GenCtx, ty: TypeInfo) -> Vec<P<ast::Item>> {
770770
.type_(&rust_name).build_ty(P(rust_ty))
771771
}
772772

773+
if ty.hide {
774+
return vec![];
775+
}
776+
773777
if ty.opaque {
774778
return mk_opaque_struct(ctx, &ty.name, &ty.layout);
775779
}

src/parser.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,10 @@ fn decl_name(ctx: &mut ClangParserCtx, cursor: &Cursor) -> Global {
211211
}
212212
CXCursor_TypeAliasDecl | CXCursor_TypedefDecl => {
213213
let opaque = ctx.options.opaque_types.iter().any(|name| *name == spelling);
214+
let hide = ctx.options.blacklist_type.iter().any(|name| *name == spelling);
214215
let mut ti = TypeInfo::new(spelling, ctx.current_module_id, TVoid, layout);
215216
ti.opaque = opaque;
217+
ti.hide = hide;
216218

217219
let ti = Rc::new(RefCell::new(ti));
218220
GType(ti)

src/types.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ pub struct TypeInfo {
821821
// TODO: Is this really useful?
822822
// You can just make opaque the underlying type
823823
pub opaque: bool,
824+
pub hide: bool,
824825
}
825826

826827
impl TypeInfo {
@@ -832,6 +833,7 @@ impl TypeInfo {
832833
ty: ty,
833834
layout: layout,
834835
opaque: false,
836+
hide: false,
835837
}
836838
}
837839
}

0 commit comments

Comments
 (0)