summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ir/comp.rs2
-rw-r--r--src/ir/context.rs10
-rw-r--r--src/ir/item.rs12
-rw-r--r--src/ir/named.rs4
-rw-r--r--src/ir/ty.rs23
5 files changed, 26 insertions, 25 deletions
diff --git a/src/ir/comp.rs b/src/ir/comp.rs
index ce6ec25d..6a9b8cb1 100644
--- a/src/ir/comp.rs
+++ b/src/ir/comp.rs
@@ -871,7 +871,7 @@ impl CompInfo {
}
impl TemplateDeclaration for CompInfo {
- fn template_params(&self, _ctx: &BindgenContext) -> Option<Vec<ItemId>> {
+ fn self_template_params(&self, _ctx: &BindgenContext) -> Option<Vec<ItemId>> {
if self.template_args.is_empty() {
None
} else {
diff --git a/src/ir/context.rs b/src/ir/context.rs
index d2fb2bef..27a43f20 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -634,7 +634,7 @@ impl<'ctx> BindgenContext<'ctx> {
.and_then(|canon_decl| {
self.get_resolved_type(&canon_decl)
.and_then(|template_decl_id| {
- template_decl_id.num_template_params(self)
+ template_decl_id.num_self_template_params(self)
.map(|num_params| {
(*canon_decl.cursor(),
template_decl_id,
@@ -658,7 +658,7 @@ impl<'ctx> BindgenContext<'ctx> {
.cloned()
})
.and_then(|template_decl| {
- template_decl.num_template_params(self)
+ template_decl.num_self_template_params(self)
.map(|num_template_params| {
(*template_decl.decl(),
template_decl.id(),
@@ -706,7 +706,7 @@ impl<'ctx> BindgenContext<'ctx> {
use clang_sys;
let num_expected_args = match self.resolve_type(template)
- .num_template_params(self) {
+ .num_self_template_params(self) {
Some(n) => n,
None => {
warn!("Tried to instantiate a template for which we could not \
@@ -1331,13 +1331,13 @@ impl PartialType {
}
impl TemplateDeclaration for PartialType {
- fn template_params(&self, _ctx: &BindgenContext) -> Option<Vec<ItemId>> {
+ fn self_template_params(&self, _ctx: &BindgenContext) -> Option<Vec<ItemId>> {
// Maybe at some point we will eagerly parse named types, but for now we
// don't and this information is unavailable.
None
}
- fn num_template_params(&self, _ctx: &BindgenContext) -> Option<usize> {
+ fn num_self_template_params(&self, _ctx: &BindgenContext) -> Option<usize> {
// Wouldn't it be nice if libclang would reliably give us this
// information‽
match self.decl().kind() {
diff --git a/src/ir/item.rs b/src/ir/item.rs
index bd401aba..00e3a30d 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -930,22 +930,22 @@ impl DotAttributes for Item {
}
impl TemplateDeclaration for ItemId {
- fn template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>> {
+ fn self_template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>> {
ctx.resolve_item_fallible(*self)
- .and_then(|item| item.template_params(ctx))
+ .and_then(|item| item.self_template_params(ctx))
}
}
impl TemplateDeclaration for Item {
- fn template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>> {
- self.kind.template_params(ctx)
+ fn self_template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>> {
+ self.kind.self_template_params(ctx)
}
}
impl TemplateDeclaration for ItemKind {
- fn template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>> {
+ fn self_template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>> {
match *self {
- ItemKind::Type(ref ty) => ty.template_params(ctx),
+ ItemKind::Type(ref ty) => ty.self_template_params(ctx),
// If we start emitting bindings to explicitly instantiated
// functions, then we'll need to check ItemKind::Function for
// template params.
diff --git a/src/ir/named.rs b/src/ir/named.rs
index 7a6c597c..e434a58d 100644
--- a/src/ir/named.rs
+++ b/src/ir/named.rs
@@ -208,7 +208,7 @@ impl<'a> MonotoneFramework for UsedTemplateParameters<'a> {
.map(|ty| match ty.kind() {
&TypeKind::TemplateInstantiation(decl, ref args) => {
let decl = ctx.resolve_type(decl);
- let params = decl.template_params(ctx)
+ let params = decl.self_template_params(ctx)
.expect("a template instantiation's referenced \
template declaration should have template \
parameters");
@@ -255,7 +255,7 @@ impl<'a> MonotoneFramework for UsedTemplateParameters<'a> {
// only used if the template declaration uses the
// corresponding template parameter.
let decl = self.ctx.resolve_type(decl);
- let params = decl.template_params(self.ctx)
+ let params = decl.self_template_params(self.ctx)
.expect("a template instantiation's referenced \
template declaration should have template \
parameters");
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index 44a88744..66136828 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -22,10 +22,11 @@ pub trait TemplateDeclaration {
/// template parameters.
///
/// Note that these might *not* all be named types: C++ allows
- /// constant-value template parameters. Of course, Rust does not allow
- /// generic parameters to be anything but types, so we must treat them as
- /// opaque, and avoid instantiating them.
- fn template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>>;
+ /// constant-value template parameters as well as template-template
+ /// parameters. Of course, Rust does not allow generic parameters to be
+ /// anything but types, so we must treat them as opaque, and avoid
+ /// instantiating them.
+ fn self_template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>>;
/// Get the number of free template parameters this template declaration
/// has.
@@ -34,8 +35,8 @@ pub trait TemplateDeclaration {
/// `template_params` returns `None`. This is useful when we only have
/// partial information about the template declaration, such as when we are
/// in the middle of parsing it.
- fn num_template_params(&self, ctx: &BindgenContext) -> Option<usize> {
- self.template_params(ctx).map(|params| params.len())
+ fn num_self_template_params(&self, ctx: &BindgenContext) -> Option<usize> {
+ self.self_template_params(ctx).map(|params| params.len())
}
}
@@ -487,18 +488,18 @@ fn is_invalid_named_type_empty_name() {
impl TemplateDeclaration for Type {
- fn template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>> {
- self.kind.template_params(ctx)
+ fn self_template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>> {
+ self.kind.self_template_params(ctx)
}
}
impl TemplateDeclaration for TypeKind {
- fn template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>> {
+ fn self_template_params(&self, ctx: &BindgenContext) -> Option<Vec<ItemId>> {
match *self {
TypeKind::ResolvedTypeRef(id) => {
- ctx.resolve_type(id).template_params(ctx)
+ ctx.resolve_type(id).self_template_params(ctx)
}
- TypeKind::Comp(ref comp) => comp.template_params(ctx),
+ TypeKind::Comp(ref comp) => comp.self_template_params(ctx),
TypeKind::TemplateAlias(_, ref args) => Some(args.clone()),
TypeKind::TemplateInstantiation(..) |