summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-10-23 11:28:22 -0500
committerGitHub <noreply@github.com>2016-10-23 11:28:22 -0500
commit9b227c81c7e92f612910fa0492346c0ef35a44a0 (patch)
tree59afb209c99cd059cd1def50a67c43ffaf554ab9 /src/codegen/mod.rs
parentf49919239c6bbb81ebea2b47aa292a708527026b (diff)
parent55e7d0514bf635667adfb938d2e17cd1de6531bb (diff)
Auto merge of #110 - heycam:stable-gen-names, r=emilio
Give vtables and anonymous items more stable generated names (fixes #60) r? @emilio This works pretty well. There are two remaining things in stylo's structs files that have identifiers that look like they won't be that stable: the anonymous enum for the NODE_* flags at the top level, and the `typedef union { ... } nsStyleUnion`. There are various anonymous enums and other things at the top level in system headers that cause these identifiers to have generated IDs in them higher than 1 and 2. Probably for anonymous enums we could just avoid generating a rust enum altogether, since having the static consts should be sufficient. I tried to mess with the codegen to automatically treat `typedef union { ... } nsStyleUnion` like `union nsStyleUnion { ... }` but it seems the way clang exposes the typedef and union are as two adjacent cursors rather than a parent-child relationship, so it's not so easy.
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 17789e19..65900739 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -445,8 +445,8 @@ impl<'a> CodeGenerator for Vtable<'a> {
}
impl<'a> ItemCanonicalName for Vtable<'a> {
- fn canonical_name(&self, _ctx: &BindgenContext) -> String {
- format!("bindgen_vtable_{}", self.item_id)
+ fn canonical_name(&self, ctx: &BindgenContext) -> String {
+ format!("{}__bindgen_vtable", self.item_id.canonical_name(ctx))
}
}