Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use path_for_whitelisting instead of canonical_path when matching #1893

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/ir/enum_ty.rs
Expand Up @@ -6,7 +6,6 @@ use super::item::Item;
use super::ty::{Type, TypeKind};
use crate::clang;
use crate::ir::annotations::Annotations;
use crate::ir::item::ItemCanonicalPath;
use crate::parse::{ClangItemParser, ParseError};
use crate::regex_set::RegexSet;

Expand Down Expand Up @@ -153,7 +152,7 @@ impl Enum {
enums: &RegexSet,
item: &Item,
) -> bool {
let path = item.canonical_path(ctx);
let path = item.path_for_whitelisting(ctx);
let enum_ty = item.expect_type();

if enums.matches(&path[1..].join("::")) {
Expand Down
7 changes: 4 additions & 3 deletions src/ir/template.rs
Expand Up @@ -28,7 +28,7 @@
//! ```

use super::context::{BindgenContext, ItemId, TypeId};
use super::item::{IsOpaque, Item, ItemAncestors, ItemCanonicalPath};
use super::item::{IsOpaque, Item, ItemAncestors};
use super::traversal::{EdgeKind, Trace, Tracer};
use crate::clang;
use crate::parse::ClangItemParser;
Expand Down Expand Up @@ -306,12 +306,13 @@ impl IsOpaque for TemplateInstantiation {
// correct fix is to make `canonical_{name,path}` include template
// arguments properly.

let mut path = item.canonical_path(ctx);
let mut path = item.path_for_whitelisting(ctx).clone();
let args: Vec<_> = self
.template_arguments()
.iter()
.map(|arg| {
let arg_path = arg.canonical_path(ctx);
let arg_path =
ctx.resolve_item(*arg).path_for_whitelisting(ctx);
arg_path[1..].join("::")
})
.collect();
Expand Down