summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2019-02-03 15:36:11 +0100
committerGitHub <noreply@github.com>2019-02-03 15:36:11 +0100
commitfa457f20d9a0b58a1fd4dc2712e997ce73803fab (patch)
tree378b003ed04262a957238929501ea645adab9d64 /src
parent86eff214bf29dc1545bfa7fd44ab2df20048e62b (diff)
parent1ea12aa2dfbfcb27ef102ec8a001a3a05175004f (diff)
Merge pull request #1513 from emilio/issue-1464
ir: Ignore constructors with bogus spellings.
Diffstat (limited to 'src')
-rw-r--r--src/ir/function.rs24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/ir/function.rs b/src/ir/function.rs
index acbfe707..fae6e056 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -337,7 +337,8 @@ impl FunctionSig {
debug!("FunctionSig::from_ty {:?} {:?}", ty, cursor);
// Skip function templates
- if cursor.kind() == CXCursor_FunctionTemplate {
+ let kind = cursor.kind();
+ if kind == CXCursor_FunctionTemplate {
return Err(ParseError::Continue);
}
@@ -347,13 +348,22 @@ impl FunctionSig {
return Err(ParseError::Continue);
}
+ // Constructors of non-type template parameter classes for some reason
+ // include the template parameter in their name. Just skip them, since
+ // we don't handle well non-type template parameters anyway.
+ if (kind == CXCursor_Constructor || kind == CXCursor_Destructor) &&
+ spelling.contains('<')
+ {
+ return Err(ParseError::Continue);
+ }
+
let cursor = if cursor.is_valid() {
*cursor
} else {
ty.declaration()
};
- let mut args: Vec<_> = match cursor.kind() {
+ let mut args: Vec<_> = match kind {
CXCursor_FunctionDecl |
CXCursor_Constructor |
CXCursor_CXXMethod |
@@ -397,9 +407,9 @@ impl FunctionSig {
let must_use =
ctx.options().enable_function_attribute_detection &&
cursor.has_simple_attr("warn_unused_result");
- let is_method = cursor.kind() == CXCursor_CXXMethod;
- let is_constructor = cursor.kind() == CXCursor_Constructor;
- let is_destructor = cursor.kind() == CXCursor_Destructor;
+ let is_method = kind == CXCursor_CXXMethod;
+ let is_constructor = kind == CXCursor_Constructor;
+ let is_destructor = kind == CXCursor_Destructor;
if (is_constructor || is_destructor || is_method) &&
cursor.lexical_parent() != cursor.semantic_parent()
{
@@ -442,8 +452,8 @@ impl FunctionSig {
}
}
- let ty_ret_type = if cursor.kind() == CXCursor_ObjCInstanceMethodDecl ||
- cursor.kind() == CXCursor_ObjCClassMethodDecl
+ let ty_ret_type = if kind == CXCursor_ObjCInstanceMethodDecl ||
+ kind == CXCursor_ObjCClassMethodDecl
{
ty.ret_type().or_else(|| cursor.ret_type()).ok_or(
ParseError::Continue,